我是一个新的HTML和我正在学习语言,但是当我试图创建此网站时,顶部照片将不会在中心对齐。我尝试过垂直对齐和填充,但运气不错。把我的代码放在下面。谢谢你的回复!在CSS中对齐照片在中心
.hudson {
color: white;
position: relative;
font-size: 60px;
top: 105px;
font-family: Futura, 'Trebuchet MS', Arial, sans-serif;
text-align: center;
}
.threeD {
text-shadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0, 0, 0, .1), 0 0 5px rgba(0, 0, 0, .1), 0 1px 3px rgba(0, 0, 0, .3), 0 3px 5px rgba(0, 0, 0, .2), 0 5px 10px rgba(0, 0, 0, .25), 0 10px 10px rgba(0, 0, 0, .2), 0 20px 20px rgba(0, 0, 0, .15);
}
.p1 {
position: relative;
text-align: center;
top: 70px;
text-align: center;
-webkit-animation-delay: 1s;
}
.p2 {
position: relative;
text-align: center;
top: 80px;
text-align: center;
-webkit-animation-delay: 1s;
}
.p3 {
position: relative;
text-align: center;
top: 90px;
text-align: center;
-webkit-animation-delay: 1s;
}
.coding {
align-items: center;
padding: 10px;
}
.paracolor {
color: skyblue;
font-size: 25px;
font-family: Orbitron;
text-align: center;
}
#icons {
padding-top: 100px;
text-align: center;
}
#icons i {
color: white;
}
body {
background-image: url(PICTURES1/mountains4.jpeg);
background-repeat: no-repeat;
}
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Orbitron" />
<link rel="stylesheet" type="text/css" href="fontawesome/css/font-awesome.min.css">
<img class="coding animated fadeInDown" src="PICTURES1/coding.png" style="max-width:125px;max-height:125px;">
<h2 class="hudson threeD animated fadeInDown">Hudson Reamer</h2>
<p class="paracolor p1 animated fadeInRightBig">blah blah blah</p>
<p class="paracolor p2 animated fadeInLeftBig">blah blah blah</p>
<p class="paracolor p3 animated fadeInRightBig">blah blah blah</p>
<div id="icons">
<a href="https://www.instagram.com/hreamer/"><i class="fa fa-instagram fa-4x"></i></a>
<a href="mailto:[email protected]"><i class="fa fa-envelope-o fa-4x"></i></a>
<a href="https://twitter.com/search?q=%40hreamer&src=typd&lang=en"><i class="fa fa-twitter fa-4x"></i></a>
</div>
'align-items'用于Flexbox项目;见:https://developer.mozilla.org/en-US/docs/Web/CSS/align-items – feeela
我试过了,它没有工作。谢谢你的评论!对不起,没有把这个问题。 – CookieM