我似乎无法将“主页”按钮置于中央。主文本位于左侧而不是中心。我的 htm 和 css 链接如下:
html:
<html>
<head>
<link rel="stylesheet" type="text/css" href="background.css"/>
</head>
<body>
<h1>Bully-Free Zone</h1>
<h2>"Online harassment has an off-line impact"</h2>
<a href="New.html" class="nav-link">Home</a>
</body>
</html>
Css:
a.nav-link:link
{
color: black;
text-decoration: underline;
font-family:broadway;
font-size:30px;
text-align:center;
}
a.nav-link:visited
{
color: black;
text-decoration: none;
}
a.nav-link:hover
{
color: black;
text-decoration: none;
}
a.nav-link:active
{
color: black;
text-decoration: none;
}
你可以把它包裹在一个div
:
<div align="center">
<a href="New.html" class="nav-link">Home</a>
</div>
或者您可以为div
:
HTML:
<div class="myDiv">
<a href="New.html" class="nav-link">Home</a>
</div>
CSS:
.myDiv {
text-align: center;
width: 300px;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)