随着屏幕尺寸变化连续调整元素大小 [英] Continuously adjust element size as screen size changes
问题描述
有一种方法可以使用媒体查询随着屏幕大小的变化(连续/平滑)逐渐更改CSS属性的值。
Is there a way to use media queries to change the value of a CSS property gradually as the screen changes size (continuously/smoothly). Instead of setting a bunch of break points at which there is a change (step-ly)?
像这个网站一样: http://www.bluegoji.com/ ?
在< ul>
顶部的< a>
标记的边距页面(导航栏)随着缩小浏览器窗口而连续减小。
Like on this site: http://www.bluegoji.com/?
The margins of the <a>
tags in the <ul>
at the top of the page (navbar) decrease continuously as you narrow the browser window.
这是我想要达到的行为。
That is the behavior I am trying to achieve.
推荐答案
您正在查找的不是媒体查询。
可以按百分比设置宽度,边距和填充。这是正常的做法。
What you are looking for is not media queries. You can set widths, margins and padding in percentages. That is the normal way of doing this.
这是一个例子:
HTML
<div>
<a>Link</a>
<a>Link</a>
<a>Link</a>
<a>Link</a>
</div>
CSS
a {
width:25%;
display:block;
float:left;
}
这篇关于随着屏幕尺寸变化连续调整元素大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!