我想为我的第一个网站建立菜单栏。正确显示1280x800菜单的窗口分辨率。但是,缩小菜单时,菜单开始对齐不正确。如何调整窗口大小时正确对齐菜单项?
HTML:
{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static 'home/style.css' %}"/>
<div class="menu">
<a href="/" class="logo"></a>
<a href="/shop" class="shopbtn" style="text-decoration:none">Buy Cherry</a>
</div>
CSS:
body {
background-color: lightgrey;
}
.menu {
position: fixed;
top: 0;
left: 0;
right: 0;
background-color: white;
min-height: 10%;
min-width: 150%;
}
.logo {
position: fixed;
top: 0%;
left: 0%;
right: 0%;
background-image: url('http://i.imgur.com/kMdEoP6.png');
width: 250px;
height: 55px;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
.logo:hover {
background-image: url('http://i.imgur.com/7d2V63b.png');
width: 249px;
height: 55px;
}
.shopbtn {
position: fixed;
font-size: 12pt;
right: 10%;
left: 23%;
top: 5%;
white-space: nowrap;
color: black;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
float: right;
}
.shopbtn:hover {
color: darkred;
我已经尝试了所有的元素加入margin-left
和margin-right
与汽车的声明,但菜单会陷入困境,仍然会错误地调整大小时去。
什么是在缩放时保持导航器正确的解决方案?有没有可以解决问题的布局?这可以在不使用Javascript的情况下完成吗?
添加您的完整代码,因为在这里只有购买樱花链接是可见的,看不到您的标志。创建一个jsfiddle会对你非常有用。 – frnt