我有一个中心对齐的H1
的标题,右侧有两个按钮。只要我添加按钮的HTML abbr H1
元素,H1
不会保持在同一高度。将中心的H1文字与垂直对齐的按钮对齐
这里是一个图片,我的代码:
@charset "UTF-8";
/* CSS Document */
html{font-family:"Lucida Grande", "Lucida Sans", "Lucida Sans Unicode", "DejaVu Sans", Verdana, sans-serif;
background-color:#4A96AD;
color:#2a2a2a;
}
h1 {text-align:center;
font-size:70px;
font-weight:700;
color:#2a2a2a;
.btn {
cursor: pointer;
margin: 8px;
border-radius: 5px;
text-decoration: none;
padding: 8px;
font-size: 18px;
transition: .5s;
-webkit-transition: .5s;
-moz-transition: .5s;
-o-transition: .5s;
display: inline-block;
}
.green {
color: #fff;
}
.green:hover {
color: #4A96AD;
background-color: #2a2a2a;
}
.buttons {
padding-top: 30px;
text-align: right;
float:top;
margin:15px
}
.btn {
cursor: pointer;
margin: 8px;
border-radius: 5px;
text-decoration: none;
padding: 8px;
font-size: 18px;
transition: .5s;
-webkit-transition: .5s;
-moz-transition: .5s;
-o-transition: .5s;
display: inline-block;
}
.home {
color: #4A96AD;
background-color: #2a2a2a;
}
.button {
padding-top: 10px;
text-align: left;
margin:15px
}
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Flash</title>
</head>
<body>
<div class="main">
<div class="buttons">
<a class="btn home" href="abcd">Home</a>
<a class="btn green" href="abcd">Next Page ></a>
</div>
<h1>FLASH</h1>
</div>
</body>
</html>
正如你所看到的, “FLASH” 是下面的按钮的高度,我要的是使“FLASH”与按钮的高度相同。 在此先感谢!
位置:绝对 –
我知道有重复遍布这个根本问题的地方。 – Rob