- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I am pretty new to HTML and CSS and am trying to get a better grasp on what display: block; actually does to your HTML. I know it can often times fix my layout problems but I never think of it until the end of my list of possible solutions (mainly because I don’t understand what it actually does). Many articles/support sites that I’ve looked at say that display block will make your element take up the whole line and not allow elements to bump up next to it, where as inline will continue the next element on the same line. My question is then, when you float elements why is it that display:block seems to allow all of the elements to sit next to each other on, seemingly, the same line.
I hope this makes sense! Thank you!
Also, it may be worth reading up on inline-block
, just to throw another into the mix! Here is an article I wrote a little while ago: http://joshnh.com/2012/02/why-you-should-use-inline-block-when-positioning-elements/
Difficult to determine the width of the element with display:inline
, difficult to centering the floated element with display:block
T_T
actually, inline elements will take left and right padding and margin but ignore top and bottom padding or margin. Inline elements also will not apply width or height (but will base height on line-height).