Pzt*_*tar 16 css zooming distortion
我已经建立了一个非常基本的网站,其中包含#conaviner div,其中包含#navbar和#content.但是,当我放大或缩小时,#navbar会扭曲,如果我放大链接会被推到彼此之下而不是内联.如果我缩小,链接之间会添加太多填充.我怎么能阻止这个?
HTML:
<div id="navbar">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="top.html">Top</a></li>
<li><strong><a href="free.html">FREE</a></strong></li>
<li><a href="photo.html">Photo</a></li>
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact Us</a></li>
</ul>
</div>
<div id="content">
<p>Some sample text.<p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
#container {
position: static;
background-color: #00bbee;
margin-left: 20%;
margin-right: 20%;
margin-top: 7%;
margin-bottom: 15%;
border: 2px solid red;
}
#navbar ul{
list-style: none;
}
#navbar li{
display: inline;
}
#navbar li a{
text-decoration: none;
color: #11ff11;
margin: 3%;
border: 1px dotted orange;
padding-left: 4px;
}
#navbar li a:hover {
background-color: white;
color: green;
}
#navbar {
background-color: #eeeeee;
padding-top: 2px;
padding-bottom: 5px;
border: 1px solid yellow;
}
Run Code Online (Sandbox Code Playgroud)
怎么能阻止它扭曲呢?
另外,我还是CSS的新手,我被教导使用%而不是px.是对的吗?还有其他任何你需要指出的,请告诉我.
提前致谢!
由于这个问题仍然得到不断的关注,我将发布我目前使用的解决方案。
CSS 媒体查询:
@media screen and (max-width: 320px) {
/*Write your css here*/
}
@media screen and (max-width: 800px) {
}
Run Code Online (Sandbox Code Playgroud)
我遇到了类似的问题,我在导航菜单中添加了一个额外的div.然后我添加了以下内容
#menu-container {
position: absolute;
white-space: nowrap;
overflow: hidden;
}
Run Code Online (Sandbox Code Playgroud)
这阻止了它的包装.希望它有效.
| 归档时间: |
|
| 查看次数: |
73865 次 |
| 最近记录: |