CSS Question: Fixed or "Flexible" DIVs?

by 1 replies
2
Hi,

I'm in the middle of a dilemma... having coded most of my sites as "fixed" with DIVs with fixed widths and heights. In some cases I haven't fixed the height, but the width was always fixed... just because I calculated everything out and it seemed well-organized.

Then: some people have the opinion that it's not good to have "fixed elements" and I should rather use min-width, max-width and similar settings... nothing fixed, but "allow it to flow"

My questions:
(1) what's the disadvantage, downside of having "fixed elements"?
(2) what if I continue to use a site with "flexible, max/min settings" for the main DIVs, but occasionally I keep using a few fixed DIVs (e.g. for ad boxes, images)... so combining fixed with "flowing"...

Thanks in advance for the help!
#website design #css #divs #fixed #flexible #question
  • It depends on the layout of your site. Fixed width just means that the element will always be that size no matter the dimensions of the browser. So if you set a fixed width on say a banner or nav menu to 1024, then a person viewing the page width a browser width of 960 would need to scroll to the right/left to see the full banner.

    Min-width and max-width just tell the browser that the element's width must be within a certain range. So if you set the min to 800 and the max to 1024 then the browser is allowed to resize the element to a size within that range if a visitor changes the dimensions of the website.

    So it really depends on how you have your site laid out. If it's a typical non-full width type page, like this, then you should be fine with leaving the fixed width alone. But if you are creating a full-width page, like this, then you need to set the min and max width.
    • [ 1 ] Thanks

Next Topics on Trending Feed

  • 2

    Hi, I'm in the middle of a dilemma... having coded most of my sites as "fixed" with DIVs with fixed widths and heights. In some cases I haven't fixed the height, but the width was always fixed... just because I calculated everything out and it seemed well-organized.