gpt4 book ai didi

html - 响应式 onesite 网站填充到中心

转载 作者:行者123 更新时间:2023-12-04 01:14:23 25 4
gpt4 key购买 nike

我目前正在制作连体衣滚动网站,但我遇到了这个问题。我希望我的文字位于第一个“页面”的中心,但我无法让它同时在手机和桌面上看起来不错。使用 padding-top: 50% 它在移动设备上看起来不错但在桌面上很糟糕,另一方面 padding-top: 7 在桌面上看起来不错但在手机上看起来不多。谁能帮我找到中庸之道?

padding 50% also padding 50%

我的 html 代码:

section {
width: 100%;
height: 100vh;
}

.main section.page1 {
background: #81D4FA;
}

.main section.page2 {
background: #F5F5F5;
}

.main section.page3 {
background: #81D4FA;
}


h1 {
font-size: 8vw;
color: #efefef;
text-align: top;
padding-top: 50%;
padding-left: 15%;
}

h2
{
list-style-type: none;
font-size: 4vw;
color: #efefef;
text-align: center;
padding-top: 2%;
}

a.read-more{
border: 2px solid #efefef;
text-decoration: none;
color: inherit;
}


.notnav {
list-style-type: none;
font-size: 3vw;
padding-top: 2%;
padding-left: 5%;
padding-right: 15%;
}
<div class="main">
<section class="page1">
<h1>
ABOUT ME
<li class="notnav">
I am John, 19 years old computer science student. Mainly coding in python, but I am quick lerner and flexible person. I am currently intrested in Artificial Intelligence, Big Data and Design
</li>
</h1>
<h2>
<a class="read-more" href='/about'>Read More</a>
</h2>
</section>
<section class="page2">
<h1>
PROJECTS
</h1>
</section>
<section class="page3">
<h1>
CONTACT
</h1>
</section>
</div>

最佳答案

试试这个(不使用媒体查询);抱歉迟到了

section {
width: 100%;
height: 100vh;
}

.main section.page1 {
background: #81D4FA;
}

.main section.page2 {
background: #F5F5F5;
}

.main section.page3 {
background: #81D4FA;
}

.page1{
display:flex;
min-height: 100%;
align-items: center;
text-align: center;
flex-direction: column;
justify-content:center;
}

h1 {
font-size: 8vw;
color: #efefef;
}

h2
{
list-style-type: none;
font-size: 4vw;
color: #efefef;
text-align: center;
}

a.read-more{
border: 2px solid #efefef;
text-decoration: none;
color: inherit;
}
.notnav {
list-style-type: none;
font-size: 3vw;
clear: both;
}

关于html - 响应式 onesite 网站填充到中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63814322/

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