Css Div Re-sizing According To Web Browser
Solution 1:
Set their sizes to percent values rather than pixels (I asume that's what you're using)
Solution 2:
Set all divs with percent values.
Or
You can use 'media rules' of css3:
@media screen and (max-width: 300px) {
.div-a {
background-color: lightblue;
}
}
Solution 3:
You have basically 3 options
- Bootstrap (http://getbootstrap.com/)
- Use percent values instead of pixels
- Use vh (view height) and vw (view width). Here's an example: http://jsfiddle.net/7m55nur1/
Note that width: 75vw;
keeps the div width at 75% of the web browser. Same as margin-left: 12.5vw
which keeps the margin on the left at 12.5% of the browser size.
Solution 4:
I figured it out, basically what i did what get the width (lets say it's 300 pixels) and figure out the percent of the page width (in my case is 1900 pixels). The result would be 15.789473684210526% putting that exact value worked just fine! As accurate as a pixel. I used this tool:
http://www.onlineconversion.com/percentcalc.htm
Thank you all for your replies!
Post a Comment for "Css Div Re-sizing According To Web Browser"