CSS Div根据Web浏览器调整大小

编程入门 行业动态 更新时间:2024-10-24 12:31:53
本文介绍了CSS Div根据Web浏览器调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有几个div在我的代码,他们所有的位置正确我想要它。唯一的问题是,他们不缩小页面缩小时。我想要能够根据Web浏览器大小重新调整大小。我不知道怎么做,我担心它可能会弄乱他们正确的顶部&左位置。所有的div都设置为绝对定位。

解决方案

我想出来了,基本上我做了什么宽度(让我们说它的300像素),并计算出页面宽度的百分比(在我的例子是1900像素)。 结果将是15.789473684210526%把确切的值工作就好了!像像素一样精确。 我使用这个工具:

www.onlineconversion/percentcalc.htm

感谢您的回复! / p>

I have a few divs on my code all of them positioned correctly how i want it. The only problem is that they do not re size when i shrink the page. I want to be able to re size them according to the web browsers size. I do not know exactly how to do it and im worried it might mess up their correct top & left position. All of my divs are currently set as absolute positioning.

解决方案

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:

www.onlineconversion/percentcalc.htm

Thank you all for your replies!

更多推荐

CSS Div根据Web浏览器调整大小

本文发布于:2023-10-08 01:51:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1471169.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浏览器   大小   CSS   Div   Web

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!