gpt4 book ai didi

html - 为什么在垂直居中后我的 div 顶部有额外的间距?

转载 作者:行者123 更新时间:2023-11-28 03:05:35 25 4
gpt4 key购买 nike

我一直在对所有带有文本的 div 使用垂直间距技巧,虽然它使垂直间距从 0% 到 90% 完美居中,但它在尖端顶部留下了更多空间,然后底部。它在我使用它的每个 div 上都这样做。我试过将 padding/margin 设置为 0 但没有任何反应。不确定具体是什么原因造成的。这很烦人。有人有想法吗?

实例-

https://jay-portfolio.herokuapp.com/

问题图片-

http://i988.photobucket.com/albums/af6/jtbitt/spacing-incorrect_zps0hjolnyv.png

HTML -

<section id="about" ng-controller="aboutController">    
<div class="container-fluid">

<div class="row about-row">

<div class="about-left col-xs-12 col-md-6">
</div>

<div class="about-right col-xs-12 col-md-6">
<div class="about-content">
<div class="about-content-title">
<h1><strong>I'M JAY.</strong></h1>
</div>

<div class="about-content-info">
<p ng-if="about.firstParagraph">{{ about.paragraphOne }}</p>
<p ng-if="!about.firstParagraph">{{ about.paragraphTwo }}</p>
</div>

<div class="about-button">
<button ng-if="about.firstParagraph" class="label label-success" ng-click="about.switchParagraph()">MORE =></button>
<button ng-if="!about.firstParagraph" class="label label-success"><a href="##skills">VIEW SKILLS</a></button>
</div>

<div class="about-personal-info">
<h4>Email: jaybittner@gmail.com</h4>
</div>

<div class="about-icon">
<a href="{{ profile.url }}" ng-repeat="profile in about.profiles"><img ng-src="{{ profile.icon }}" /></a>
</div>
</div>

</div>

</div>

</div>
</section>

CSS -

#about {
height: 100%;
width: 100%;
background: rgba(0,97,65,1);
background: -moz-linear-gradient(left, rgba(0,97,65,1) 0%, rgba(54,135,95,1) 7%, rgba(36,123,85,1) 22%, rgba(0,97,65,1) 53%, rgba(34,121,84,1) 76%, rgba(54,135,95,1) 90%, rgba(54,135,95,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(0,97,65,1)), color-stop(7%, rgba(54,135,95,1)), color-stop(22%, rgba(36,123,85,1)), color-stop(53%, rgba(0,97,65,1)), color-stop(76%, rgba(34,121,84,1)), color-stop(90%, rgba(54,135,95,1)), color-stop(100%, rgba(54,135,95,1)));
background: -webkit-linear-gradient(left, rgba(0,97,65,1) 0%, rgba(54,135,95,1) 7%, rgba(36,123,85,1) 22%, rgba(0,97,65,1) 53%, rgba(34,121,84,1) 76%, rgba(54,135,95,1) 90%, rgba(54,135,95,1) 100%);
background: -o-linear-gradient(left, rgba(0,97,65,1) 0%, rgba(54,135,95,1) 7%, rgba(36,123,85,1) 22%, rgba(0,97,65,1) 53%, rgba(34,121,84,1) 76%, rgba(54,135,95,1) 90%, rgba(54,135,95,1) 100%);
background: -ms-linear-gradient(left, rgba(0,97,65,1) 0%, rgba(54,135,95,1) 7%, rgba(36,123,85,1) 22%, rgba(0,97,65,1) 53%, rgba(34,121,84,1) 76%, rgba(54,135,95,1) 90%, rgba(54,135,95,1) 100%);
background: linear-gradient(to right, rgba(0,97,65,1) 0%, rgba(54,135,95,1) 7%, rgba(36,123,85,1) 22%, rgba(0,97,65,1) 53%, rgba(34,121,84,1) 76%, rgba(54,135,95,1) 90%, rgba(54,135,95,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#006141', endColorstr='#36875f', GradientType=1 );
background-repeat: no-repeat;
color: #101010;
border-bottom: 3px solid black;
}

#about .container-fluid, #about .row {
height: 100%;
}

.about-left {
height: 100%;
background-image: url('../../images/jay-ocean.jpg');
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
border-right: 3px solid #101010;
}

.about-right {
height: 100%;
width: 50%;
text-align: center;
position: relative;
}

.about-content {
width: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin-left: auto;
margin-right: auto;
}

.about-content-title h1{
font-size: 3.1vw;
margin-bottom: 0.6vh;
}

.about-content-info p {
font-size: 1vw;
word-spacing: 0.3vw;
margin-bottom: 0.7vh;
}

.about-button button {
margin-bottom: -0.1vh;
}

.about-personal-info h4 {
margin-bottom: 0.7vh;
}

.about-button button {
color: gray;
border: 1px solid #101010;
background-color: #101010;
font-size: 0.7vw;
}

.about-button a {
color: gray;
}

.about-personal-info h4 {
font-size: 1vw;
word-spacing: 0.3vw;
}

.about-icon img {
height: 3.5vh;
width: 1.75vw;
border-radius: 10px;
border: 1px solid #101010;
margin: 3px;
}

@media only screen and (max-width: 992px) {
.about-left {
height: 50%;
border-bottom: 3px solid black;
}

.about-right {
height: 50%;
width: 100%;
}

.about-content {
width: 70%;
}

.about-content-title h1 {
font-size: 5vw;
}

.about-content-info p {
font-size: 2.5vw;
}

.about-button button {
font-size: 2.5vw;
}

.about-personal-info h4 {
font-size: 2.5vw;
}

.about-icon img {
height: 20px;
width: 20px;
}
}

最佳答案

尝试添加*{margin:0px; padding:0px;} 到你的样式表,然后从那里编辑你的 div 标签。祝你好运。

关于html - 为什么在垂直居中后我的 div 顶部有额外的间距?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32733026/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com