/    Sign up×
Community /Pin to ProfileBookmark

float:left, fails to work.

hi! I had 3 div class=”columndiv” with 3 images going down, so 3×3 grid. I decided to change the layout to 2 images on the left, and 2 on the right, with 1 big image in the middle, yet now the float fails to work for the last column. Instead ie decides to place them below eachother (in firefox it works).

HTML

[CODE]
<div class=”columndiv”>
<div class=”menubox”>
<img src=”menuimg.jpg” class=”menuimg” alt=”Menu” />
</div>
<div class=”spacebox”></div>
<div class=”menubox”>
<img src=”menuimg.jpg” class=”menuimg” alt=”Menu” />
</div>
</div>

<div class=”columndiv”>
<div class=”menucenterimg”>
<img src=”dane.jpg” alt=”Dane McCalam, photographer” />
</div>
</div>

<div class=”columndiv”>
<div class=”menubox”>
<img src=”menuimg.jpg” class=”menuimg” alt=”Menu” />
</div>
<div class=”spacebox”></div>
<div class=”menubox”>
<img src=”menuimg.jpg” class=”menuimg” alt=”Menu” />
</div>
</div>
[/CODE]

CSS

[CODE]
div.columndiv {
float:left;
}

div.breakdiv
{
clear.both;
}

div.menubox {
width:150px;
height:150px;
margin:20px;
border:3px solid #666666;
}

div.menucenterimg {
height:600;
}

div.spacebox {
height:260px;
}
[/CODE]

Also, what is the standard/best naming convention for classes/ids?

to post a comment
CSS

1 Comments(s)

Copy linkTweet thisAlerts:
@TancrediDec 24.2009 — you have a lot of divs in the markup. Maybe create a container div and apply an id selector to it, set its width to 153px.
×

Success!

Help @alexpnd spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...