我的网页
我的网页最小化
正如你在图片中看到的,当它是整个页面时,它看起来很好。但是当我最小化屏幕时,按钮看起来关闭了。我如何修复它?我想让我的按钮不飞起来这里是我的整个代码。
我尝试使用 metaviewport标签,但它不起作用。
body {
background-color: #F0EAD6;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.header {
display: flex;
align-items: center;
background-color: #00704A;
color: white;
height: 60px;
padding: 0 20px;
}
.logo {
width: 106px;
height: 64px;
margin-right: auto;
}
.button {
display: inline-block;
padding: 10px 20px;
border-radius: 20px;
margin-left: 10px;
background-color: white;
color: #00704A;
font-weight: bold;
text-decoration: none;
transition: background-color 0.19s ease, color 0.19s ease;
}
.button:hover {
background-color: #00704A;
color: white;
}
#headright {
margin-right: 55%;
}
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<header class="header">
<img class="logo" src="..\WP project\Central-Perk-Emblem.png" alt="Central Perk logo">
<div id="headright">
<a class="button" href="#">HOME</a>
<a class="button" href="#">MENU</a>
<a class="button" href="#">GIFT SHOP</a>
</div>
<div id="headleft">
<a class="button" href="#">Find a Store</a>
<a class="button" href="#">Sign In</a>
<a class="button" href="#">Join Now</a>
</div>
</header>
3条答案
按热度按时间cwxwcias1#
我做了一些改变与利润率,宽度,填充,高度。
我认为问题的发生是由于缺乏空间。
lztngnrs2#
您需要在下面给出您的 headright 和 headleft,因为您的容器可能有一些其他的
display
属性,因此您无法将按钮放入其中这应该行得通。
wz1wpwve3#
很好的设计。所以我认为你的问题可能在于你在代码中使用了百分比。在页边空白处使用百分比值不是最好的做法。我认为这就是为什么设计总是一团糟。如果你想调整代码以适应更小的屏幕,你可以总是使用媒体查询,但永远不要使用百分比。我对代码做了一些调整,还为较小的屏幕添加了一个媒体查询。你可以检查添加了注解的代码。我使用的是flex,特别是flex-end,将按钮一直推到页面的末尾(一直推到右边)。我希望这能有所帮助。