- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘Other’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
On a LinkdIn thread for a UL element not showing, one poster made an interesting statement:
“Pro tip of the day:
Never use the height property. Always use either a margin or a padding value for the purpose.”
which gave me pause… So, I thought I would run that past this forum… Why NOT use a height attribute? Granted, some smaller devices may need additional styling for the height of an element.
Probably better to say “You don’t NEED to use height.” Because… you don’t. Many times… things are made much easier if you just omit it and let divs grow as they will.
Indeed…if I’m doing a nav, I’m letting the size of the anchors determine the height.
Height to my mind should be determined from the inside out.
I may use padding or line-height, rarely margin, for the height. If I need extra space around the nav, I’ll add extra padding to that.
Now this doesn’t always apply to all elements but for a nav bar/column…I find it works most of the time.
Now this doesn’t always apply to all elements but for a nav bar/column…I find it works most of the time.
This.
That’s what I hate about statements like this guy’s “pro tip”. They just confuse the hell out of people. That’s why little tips on twitter are so frustrating… unless there’s a longer explanation in blog form.
Paulie’s right though… think about how often you have to EXPLICITLY set height. Maybe max-height
or line-height
but height
? Probably less often than you think.