Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我在我的网页顶部有这个横幅。从我的 23" 显示器观看时看起来不错。但是当我用我的 15" 方形显示器观看时,横幅会因为太长而从右侧剪掉。
如何使用 CSS 使横幅的宽度根据用户的屏幕尺寸进行调整?
它不仅应该根据用户的屏幕大小,还应该根据浏览器窗口的大小。
尝试width: 100%
width: 100%
而不是使用像素来设置固定宽度,您可以使用百分比,例如
宽度:100%;