我正在尝试为freecodecamp创建投资组合,但是我无法找到如何将按钮居中,或将div标记为“行”在页面上居中。我需要行div,因为稍后将添加更多按钮,但是现在我只需要FCC按钮。到目前为止,以下是我网站的html和css文件。欢迎任何帮助!
HTML:
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
<!-- Web page starts here -->
<body id="body">
<section id="land">
<h1 id="mpp" class="text-center"> My Personal Portfolio </h1>
<div class="row" id="btnrow">
<a href="http://www.freecodecamp.com/zacmelendez" class="btn responsive" id="fcc"><i class="fa fa-file-code-o"> Free Code Camp</i></a>
</div>
</section>
<section id="intro">
</section>
</body>
CSS:
#body {
height: 100vh;
width: 100%;
}
#mpp {
font-family: Monospace;
font-size: 50px;
color: white;
padding-top: 15%;
margin: 0;
}
#land {
background: url(http://img.hrhwalls.com/images2/ki13j11c4ef.jpg);
width: 100%;
height: 100vh;
}
#fcc {
background-color: #016403;
text-decoration: none;
color: #FFFFFF;
font-size: 17px;
position: inherit;
}
#btnrow {
right: 50%;
}
#btnrow {
display: flex;
justify-content: center;
}
应该做的把戏。请参阅下面的工作示例
#body {
height: 100vh;
width: 100%;
}
#mpp {
font-family: Monospace;
font-size: 50px;
color: white;
padding-top: 15%;
margin: 0;
}
#land {
background: url(http://img.hrhwalls.com/images2/ki13j11c4ef.jpg);
width: 100%;
height: 100vh;
}
#fcc {
background-color: #016403;
text-decoration: none;
color: #FFFFFF;
font-size: 17px;
position: inherit;
}
#btnrow {
display: flex;
justify-content: center;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
<!-- Web page starts here -->
<body id="body">
<section id="land">
<h1 id="mpp" class="text-center"> My Personal Portfolio </h1>
<div class="row" id="btnrow">
<a href="http://www.freecodecamp.com/zacmelendez" class="btn responsive" id="fcc"><i class="fa fa-file-code-o"> Free Code Camp</i></a>
</div>
</section>
<section id="intro">
</section>
</body>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句