I want to make the width of the footer browser-independent.
For Mozilla I want to use the value of -moz-available
, and when a user uses Opera, then CSS should get the values from -webkit-fill-available
.
How can I do this in CSS 3?
I tried to do something like this:
width: -moz-available, -webkit-fill-available;
This won't give the desired results.
To convert it to a fixed-width layout, simply add a fixed with to the #wrapper and set the margins to auto. Setting the margins to auto will cause the left and right margins to be equal no matter how wide the browser window is, which will cause your fixed-width layout to be positioned in the center of the browser.
The width CSS property sets an element's width. By default, it sets the width of the content area, but if box-sizing is set to border-box , it sets the width of the border area.
CSS will skip over style declarations it doesn't understand. Mozilla-based browsers will not understand -webkit
-prefixed declarations, and WebKit-based browsers will not understand -moz
-prefixed declarations.
Because of this, we can simply declare width
twice:
elem { width: 100%; width: -moz-available; /* WebKit-based browsers will ignore this. */ width: -webkit-fill-available; /* Mozilla-based browsers will ignore this. */ width: fill-available; }
The width: 100%
declared at the start will be used by browsers which ignore both the -moz
and -webkit
-prefixed declarations or do not support -moz-available
or -webkit-fill-available
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With