CSS layout: Float elements vs inline elements
Posted: 16 June 2008 02:50 AM   [ Ignore ]  
Research Assistant
RankRankRank
Total Posts:  423
Joined  03-23-2004

Hello,

I have built a lot of layouts using floats. The purpose is to be able to get elements next to each other horizontally. This is very useful but yesterday I had strange thoughts about turning <div> elements into inline elements. Given a fixed width outer wrapper, shouldn’t inline elements behave exactly like floats? If so, why isn’t anyone using inline elements rather than floated elements?

Profile
 
 
Posted: 16 June 2008 03:04 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  881
Joined  02-15-2008

A floated element can still be a block element, meaning you can still specify its width and height and apply vertical margin/padding. Once you turn an element inline, you can’t.

So as long as you don’t need to be specific with dimensions or margin/padding, you can go inline if it works for you.

 Signature 

Andy Harris | Pepper Digital | Malvern, UK | Twitter | New to ExpressionEngine? Start here!
Remember - If at first you don’t succeed, you’re not Chuck Norris

Profile
 
 
Posted: 16 June 2008 05:29 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
RankRankRank
Total Posts:  423
Joined  03-23-2004

Hi Andy!

Thanks for that info. I since researched the inline model some more and ended up with this article.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64906 Total Logged-in Users: 33
Total Topics: 81851 Total Anonymous Users: 32
Total Replies: 440054 Total Guests: 249
Total Posts: 521905    
Members ( View Memberlist )