Reputation: 157
I'm trying to design a fluid / responsive web design using bootstrap. I'm trying to design the layout so that it'll fit in many devices. My question about setting height to a layout element, such as the header or footer. I've got it in pixels right now, but I would like to know if I should be using some other form of measurement.
I'm probably over-thinking this, but I'd like to make sure I'm doing this the right way. Thanks in advance!
Upvotes: 0
Views: 180
Reputation: 9464
Avoid setting a height
whenever possible. You can often get around - and preferably so - using padding
on the element in question, and/or margin
values on the element's children.
If you absolutely need to define a height, use min-height
so that it'll grow as its children take up more vertical space.
Many times people fall back to defining static height
values because the elements are also using float
and add height to get content flow and backgrounds back. This is rather poor practice and if this is the case you should consider looking into methods of clearing floats.
Upvotes: 1
Reputation: 29
em and % is the good solution for fluid / responsive web design.
I will suggest for media query css
@media only screen and (max-device-width: 480px) { }
Upvotes: 0
Reputation: 8833
Probably pixels are the best option if you have a lot different devices. Other measurements to consider:
Upvotes: 0