Advertisement:

Author Topic: [TIP]4 columns instead of 3  (Read 2921 times)

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
[TIP]4 columns instead of 3
« on: October 17, 2013, 02:01:22 am »
I have limited the amount of sub categories to show only 8, I did a min-height to 218px, and basically the home page is turning out great.
I would like to have it as four columns instead of three, my css kung-fu is great, but not good enough. tried the "nths"; tried $col1_max_cat       = ceil($total_categories/4);
tried stealing from modern....

anyone have any other ideas?  ???

in my perfect world I'd have the first four in a row, then the rest in the three column format  8)

more than one way to kill a cat!
« Last Edit: October 17, 2013, 07:49:10 pm by design »

strata

  • Sr. Member
  • ****
  • Posts: 411
  • Always good, always...
Re: 4 columns instead of 3
« Reply #1 on: October 17, 2013, 03:46:41 am »
Change this line on main.css :
Code: [Select]
.cell_3 {
    width: 33%;
    float: left;
}
become :
Code: [Select]
.cell_3 {
    width: 23%;
    float: left;
}
and
Code: [Select]
div.cell_3:nth-child(2n) {
    margin: 0 1%;
    width: 31%}
become
Code: [Select]
div.cell_3:nth-child(3n) {
    margin: 0 1%;
    width: 21%}

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: 4 columns instead of 3
« Reply #2 on: October 17, 2013, 07:48:28 pm »
whooop
using strata's CSS above plus this code thanks to my hero teseo. this is what did it: if($i%9 == 0) & ceil($total_categories/9);
also need to change the media
Code: [Select]
body div.cell_3:nth-child(3n)change to your own amount of categories, where mine is 9. in functions.php

       
Code: [Select]
$col1_max_cat       = ceil($total_categories/9);

         osc_goto_first_category();
         $i      = 0;

         while ( osc_has_categories() ) {
         ?>
        <?php
            
if($i%$col1_max_cat == 0){
                if(
$i 0) { echo '</div>'; }
                if(
$i%== 0){
                   echo 
'<div class="cell_3 first">';
                } else {
                    echo 
'<div class="cell_3">'
                } 
             }
        
?>
« Last Edit: October 17, 2013, 08:14:44 pm by design »

thedaigle

  • Jr. Member
  • **
  • Posts: 81
Re: [TIP]4 columns instead of 3
« Reply #3 on: October 18, 2013, 10:31:25 pm »
mind posting a screenshot to show how it turned out?

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: [TIP]4 columns instead of 3
« Reply #4 on: October 21, 2013, 10:35:36 pm »
here you go..sorry that took so long. upgraded and godaddy crashed..

tabuausada

  • Jr. Member
  • **
  • Posts: 77
Re: [TIP]4 columns instead of 3
« Reply #5 on: October 25, 2013, 12:10:04 am »
here you go..sorry that took so long. upgraded and godaddy crashed..
Hi Design,

First of all thanks a lot for all your inputs!

When looking at the picture in your previous msg I noticed that your categories are aligned independently of the number of subcategories shown.

Can you please indicate how to achieve that alignment? I can't figure out how to align my categories in bender theme (see screenshot pls)...


design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: [TIP]4 columns instead of 3
« Reply #6 on: October 25, 2013, 12:47:14 am »
combining the max amount of subcategories viewed I added the secret ingredient of min-height to the ul in the css  ;D


edited to add: I changed the width of the main 1020 and reduced the sidebar. and adjusted things accordingly. watching the screen size , logged in user/admin. it really changed a lot!
« Last Edit: October 25, 2013, 01:07:20 am by design »