【发布时间】:2017-07-26 02:24:28
【问题描述】:
我已经搜索和搜索并发现了类似的问题,但以前的线程都不能帮助我解决我的问题。在我的桌面主页上,导航菜单向右浮动。但是,当在移动设备上调整大小或查看时,我希望菜单项居中而不是向右浮动,因为它看起来很乱。我尝试了其他帖子的各种建议,但似乎没有任何效果,这让我发疯了。我已经尝试媒体查询将对齐更改为低于一定大小并且没有成功,所以我一定做错了什么。此外,这不是一个重要的优先事项,但我注意到标题徽标在移动版本中被剪裁得非常轻微,所以如果有人也能帮助我,那就太好了。提前感谢您的帮助!
请查看随附的屏幕截图。 Desktop Version Mobile Version
编辑:对不起,我忘了发布代码。这是针对大学课程的,所以现在 CSS 和 HTML 合并到一个文档中,但稍后会有单独的样式表。此外,可以在 geocities.ws/dinetown 看到实时版本
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0">
<style>
#container {
min-height: 100%;
position: relative;
}
#header {
padding: 1em;
color: white;
background: black;
text-align: left;
}
#content {
padding-bottom: 50px;
}
footer {
height: 50px;
line-height: 50px;
left:0px;
bottom:0px;
position: absolute;
width: 100%;
display: inline-block;
color: white;
background: black:
font-family: Majesti;
background: black;
text-align: center;
vertical-align: center;
}
.header img {
float: left;
background: black;
width:100%;
overflow: hidden;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
width: 100%;
background-color: rgb(190, 30, 45);
font-family: Athelas;
}
li {
float: right;
}
li a {
float: right;
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: maroon;
}
html,
body {
margin: 0;
padding: 0;
height: 100%;
font-family: Athelas;
color: white;
background: rgb(65, 57, 61);
}
p {
padding-left: 30px;
padding-right: 30px;
padding-top: 15px;
padding-bottom: 15px;
}
</style>
<title>Welcome to Town</title>
</head>
<body style="margin: 0;">
<div id="container">
<div id="header">
<img src="images/logo.svg" width="400px">
</div>
<div id="content">
<ul>
<li><a href="contact.html">CONTACT</a></li>
<li><a href="about.html">ABOUT US</a></li>
<li><a href="gallery.html">GALLERY</a></li>
<li><a href="social.html">SOCIAL HOUR</a></li>
<li><a href="menu.html">MENU</a></li>
<li><a class="active" href="index.html">HOME</a></li>
</ul>
<section style="margin: 0;">
<img src="images/dining_room.png" width="100%" overflow="hidden">
</section>
<article>
<p align="center">
Our mission is to bring <b><i>quality</i></b>, <b><i>style</i></b> and the wish for
<b><i>good fortune</i></b> to all of our guests. We provide a high-end dining
experience through Chinese cuisine.
</p>
</article>
</div>
<footer>
© 2017 Andrew Struppa
</footer>
</div>
</body>
</html>
【问题讨论】:
-
请分享html+css或创建小提琴
标签: html css responsive-design