我想编写一个基本的HTML导航标题的乐趣和教自己一些CSS/HTML,但我不能让我的东西安排在我的意图。CSS标志,链接,配置文件对齐问题
我想有最左边,一些链接在中间和右侧的用户图标页面的标志,这里是一个MOC的想法: 这是屠宰代码在一起的结果:(
我觉得我的想法工作,我需要创建这样一个整体的容器 里面的东西3元位置,但我似乎无法找到这样做的有效方式。
这是我目前的CSS代码:
html {
height:100%;
background-color: #f8f8ff;
min-width: 800px;
max-width: 1000px;
margin: auto;
}
body {
background-color: #FFF;
}
.topnav-logo{
float:left;
background-color: #f8f8ff;
margin: 0;
padding: 0;
}
.topnav-profile{
float:right;
background-color: #f8f8ff;
}
.topnav{
background-color: #f8f8ff;
margin: 0;
padding: 0;
width: auto;
}
ul.topnav {
list-style-type: none;
overflow: hidden;
}
/* Float the list items side by side */
ul.topnav li {
float: left;
line-height: 110px;
}
/* Style the links inside the list items */
ul.topnav li a {
display: inline-block;
color: RGB(120,200,250);
padding: 0px 10px;
text-decoration: none;
transition: 0.3s;
font-size: 30px;
}
,并用它去的HMTL目前看起来是这样的:
<html>
<head>
<link rel="stylesheet" href="stylesheet.css" type="text/css"/>
<title> </title>
</head>
<body>
<a class="topnav-logo" href="index.html"><img src="images/logo.jpg" alt="site-logo"></a>
<ul class="topnav" id="Topnav">
<li><a href="">Link</a></li>
<li><a href="">Link</a></li>
<a class="topnav-profile" href="index.html"><img src="images/profile.png" alt="user profile"></a>
</ul>
body content
</body>
感谢阅读长度和任何帮助表示赞赏:)
编辑:这么多伟大的回复,谢谢所有!对不起,反馈较晚,纽约时间分心:(
只是为了澄清,我不希望把徽标,链接和配置文件之间的物理可视线我只使用这些图像作为示范我想每一个元素容器我期待对齐链接文本和个人资料图片如下:
链接:垂直中间,水平中间
档案IMG:垂直中间,水平右
你更愿意使用像引导一个框架? – Abk
Ben说:“为了好玩并教会自己一些CSS/HTML”,我不认为他更喜欢bootstrap。 –
你不需要'html'元素上的'min-width'或'max-width'。 'margin:auto'也不会对'html'元素做任何事情。 –