/    Sign up×
Community /Pin to ProfileBookmark

divs to Float until on next row

I have 4 divs they are each 117px wide and go into a parent div that is at 371px so 3 of these divs will fit side by side with Float=”left”. When the 4th goes to the next row it goes to the left which is what it is supposed to do.

I want 3 divs on 1 row and the next to go centered of the next row.

It is not always going to be 4 divs I am using 4 to test and get the code working the way I want it to because it is 1 more than the max for the first row.

Here is my code.

[code=html]
<div id=”images”>
<div id=”section”>
<img src=”http://www.ideachampions.com/weblogs/american-flag-2a.jpg” onclick=”getText(‘VanessaIntro’)”>
<div id=”SectionTitle”>
Intro
</div>
</div>
<div id=”section”>
<img src=”http://www.ideachampions.com/weblogs/american-flag-2a.jpg” onclick=”getText(‘VanessaOrigins’)”>
<div id=”SectionTitle”>
Origins
</div>
</div>
<div id=”section”>
<img src=”http://www.ideachampions.com/weblogs/american-flag-2a.jpg” onclick=”getText(‘VanessaCulture’)”>
<div id=”SectionTitle”>
Culture
</div>
</div>
<div id=”section”>
<img src=”http://www.ideachampions.com/weblogs/american-flag-2a.jpg” onclick=”getText(‘VanessaAssimilation’)”>
<div id=”SectionTitle”>
Assimilation
</div>
</div>
</div>
[/code]

here is my CSS

[CODE]
#images{
height:50%;
background-color:green;
text-align:center;
}
#images img{
height:88px;
}
#info{
height:50%;
background-color:yellow;
}
#SectionTitle{
width:100%;
font-size:17px;
}
#section{
width:117px;
height:50%;
float:left;
padding-left:5px;
}
[/CODE]

I hope someone can help me out! Thanks!

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@josephbm91Mar 05.2010 — A div id is a unique identification for the div element. If you want to repeat the styles, use a div class.

See Div Class vs Div ID
Copy linkTweet thisAlerts:
@ExcavatorakMar 06.2010 — Hello Xtrme_XJ,

Have a look at a thumbnail presentation of mine. You've described it exactly.
Copy linkTweet thisAlerts:
@Xtrme_XJauthorMar 08.2010 — That is EXACTLY what I Wanted....

Also I may be turning in my css handbook and destroying my computer after messing up class and ID. I have been programming for way too long to mess that crap up.
×

Success!

Help @Xtrme_XJ 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...