gpt4 book ai didi

jquery - 垂直居中对齐全屏 div

转载 作者:太空宇宙 更新时间:2023-11-03 23:28:34 25 4
gpt4 key购买 nike

其实我想做一个全屏的div,div里面的文字会垂直居中。我通过 css 尝试了很多,但没有完全按照我的意愿工作。我知道如果我修复了 div 它会起作用,但我也想向下滚动到另一个 div。

我希望我的元素看起来像(初始全屏部分):http://perfectpointdev.com/perfect-design/

我想把我元素的灰色背景部分作为perfectpointdev.com网站的初始部分。请帮帮我...

我在 jsfiddle 中的演示元素:http://jsfiddle.net/zinannadeem/08wve09t/

#home{
height:100%;
display:table;
min-height:100%;
vertical-align:milddle;
width:100%;
position:relative;
}
.welcome-text{
display:table-cell;
position:relative;
vertical-align:middle;
z-index:3;
text-align:center;
color:#000;
font-size:16px;
background:#eee;
z-index:99;
}
.welcome-text .container{
max-width:800px;margin:0 auto;
}
<section id="home">
<div class="welcome-text">
<div class="container">
<h2>We Are Awesome</h2>
<p>Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer</p>
</div>
</div>
</section>

<section id="about">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<h2 class="page-title">Perfect design build awesome templates for you!</h2>
<p>Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without revolutionary ROI. Efficiently unleash cross-media information without cross-media value. Quickly maximize timely deliverables for real-time schemas. Dramatically maintain clicks-and-mortar solutions without functional solutions.</p>

<p>Completely synergize resource sucking relationships via premier niche markets. Professionally cultivate one-to-one customer service with robust ideas. Dynamically innovate resource-leveling customer service for state of the art customer service.</p>

<p><a class="btn btn-primary" href="">Buy It Now</a> <a class="btn btn-primary" href="">See WP Version</a></p>
</div>
</div>
</div>
</section>
<section id="about">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<h2 class="page-title">Perfect design build awesome templates for you!</h2>
<p>Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without revolutionary ROI. Efficiently unleash cross-media information without cross-media value. Quickly maximize timely deliverables for real-time schemas. Dramatically maintain clicks-and-mortar solutions without functional solutions.</p>

<p>Completely synergize resource sucking relationships via premier niche markets. Professionally cultivate one-to-one customer service with robust ideas. Dynamically innovate resource-leveling customer service for state of the art customer service.</p>

<p><a class="btn btn-primary" href="">Buy It Now</a> <a class="btn btn-primary" href="">See WP Version</a></p>
</div>
</div>
</div>
</section>
<section id="about">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<h2 class="page-title">Perfect design build awesome templates for you!</h2>
<p>Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without revolutionary ROI. Efficiently unleash cross-media information without cross-media value. Quickly maximize timely deliverables for real-time schemas. Dramatically maintain clicks-and-mortar solutions without functional solutions.</p>

<p>Completely synergize resource sucking relationships via premier niche markets. Professionally cultivate one-to-one customer service with robust ideas. Dynamically innovate resource-leveling customer service for state of the art customer service.</p>

<p><a class="btn btn-primary" href="">Buy It Now</a> <a class="btn btn-primary" href="">See WP Version</a></p>
</div>
</div>
</div>
</section>

最佳答案

.center {
position: absolute;
width: 100px;
height: 50px;
top: 50%;
left: 50%;
margin-left: -50px;
margin-top: -25px;
}
<div class='full-screen'>
<div class="center">FULL SCREEN</div>
</div>

尝试:JSFiddle

编辑:JSFiddle

关于jquery - 垂直居中对齐全屏 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25982997/

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