如何消除我的各个部分之间的疯狂差距

发布于 2025-01-23 16:51:29 字数 3001 浏览 2 评论 0原文

我的各个部分之间存在巨大的差距,我不知道为什么我尝试以#me {padding-bottom:150px的形式添加填充; }但是我尝试了不同的数字,在使差距更长的时间时,我看到有所不同,但是当我尝试进行负面影响时,它似乎真的不会影响实际发生的事情。

这是我的HTML代码

.container {
    width: 100%;
    height: 100%;
    background: #12182b;}

    .me-section {
    text-align: left;
    padding-left: 850px; 
    height: 100vh;
    margin-top: 320px;}

 
    .me-section h1 {
    color: #6dffe7;
    font-size: 20px;
    margin: 0px;}

    .about-section {
    text-align: left;
    padding-left: 850px; 
    height: 100vh;
    margin-top: 320px;}

    .about-section h1 {
    color: #6dffe7;
    font-size: 20px;
    padding-top: 150px;}
 <div class="container">
        <img src="logo.png" class="logo">

            <div class="header">
                <nav class="navbar">
                    <ul>
                        <div class="download-btn">
                            <li><a href="#about" class="about-2">About</a></li>
                            <li><a href="#work" class="work-3">Work</a></li>
                            <li><a href="#contact" class="contact-4">Contact</a></li>
                            <li><a href="Alberto Aday Resume.docx" class="btn">Resume</a></li>
                        </div>
                    </ul>
                </nav>



                <section id="me">
                    <div class="me-section">
                        <h1 class="my-name-after">Hi, my name is</h1>
                        <h2 class="header-name">Alberto Aday.</h2>
                        <h2 class="header-rest">I build on the web.</h2>
                        <p>I'm an aspiring software engineer. I like to build<br>websites. Back-end development is currently <br>progress.</p>
                    </div>
                </section>



                <section id="about">
                    <div class="about-section">
                        <h1>About me.</h1>
                    </div>
                </section>



                <section id="work">
                    <div class="work-section">
                        <h1>Work</h1>
                    </div>
               </section>



                <section id="contact">
                    <div class="contact-section">
                        <h1>Contact</h1>
                    </div>
                </section>



            </div>

    

there is a huge gap between my sections and I have no clue why i have tried adding padding in the form of #me { padding-bottom: 150px; } but i tried with different numbers and i see a difference when making the gap longer but when i try going negitive, it cant really seem to have an affect on whats actually going on.

here is my code for HTML

.container {
    width: 100%;
    height: 100%;
    background: #12182b;}

    .me-section {
    text-align: left;
    padding-left: 850px; 
    height: 100vh;
    margin-top: 320px;}

 
    .me-section h1 {
    color: #6dffe7;
    font-size: 20px;
    margin: 0px;}

    .about-section {
    text-align: left;
    padding-left: 850px; 
    height: 100vh;
    margin-top: 320px;}

    .about-section h1 {
    color: #6dffe7;
    font-size: 20px;
    padding-top: 150px;}
 <div class="container">
        <img src="logo.png" class="logo">

            <div class="header">
                <nav class="navbar">
                    <ul>
                        <div class="download-btn">
                            <li><a href="#about" class="about-2">About</a></li>
                            <li><a href="#work" class="work-3">Work</a></li>
                            <li><a href="#contact" class="contact-4">Contact</a></li>
                            <li><a href="Alberto Aday Resume.docx" class="btn">Resume</a></li>
                        </div>
                    </ul>
                </nav>



                <section id="me">
                    <div class="me-section">
                        <h1 class="my-name-after">Hi, my name is</h1>
                        <h2 class="header-name">Alberto Aday.</h2>
                        <h2 class="header-rest">I build on the web.</h2>
                        <p>I'm an aspiring software engineer. I like to build<br>websites. Back-end development is currently <br>progress.</p>
                    </div>
                </section>



                <section id="about">
                    <div class="about-section">
                        <h1>About me.</h1>
                    </div>
                </section>



                <section id="work">
                    <div class="work-section">
                        <h1>Work</h1>
                    </div>
               </section>



                <section id="contact">
                    <div class="contact-section">
                        <h1>Contact</h1>
                    </div>
                </section>



            </div>

    

example

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蒗幽 2025-01-30 16:51:29

我继续删除了巨大的利润,是的,确实改变了事物的位置,但也造成了大量的空格。

.container {
    width: 100%;
    height: 100%;
    background: #12182b;}

    .me-section {
    text-align: left;
    padding-left: 850px; }

 
    .me-section h1 {
    color: #6dffe7;
    font-size: 20px;
    margin: 0px;}

    .about-section {
    text-align: left; }

    .about-section h1 {
    color: #6dffe7;
    font-size: 20px;}
 <div class="container">
        <img src="logo.png" class="logo">

            <div class="header">
                <nav class="navbar">
                    <ul>
                        <div class="download-btn">
                            <li><a href="#about" class="about-2">About</a></li>
                            <li><a href="#work" class="work-3">Work</a></li>
                            <li><a href="#contact" class="contact-4">Contact</a></li>
                            <li><a href="Alberto Aday Resume.docx" class="btn">Resume</a></li>
                        </div>
                    </ul>
                </nav>



                <section id="me">
                    <div class="me-section">
                        <h1 class="my-name-after">Hi, my name is</h1>
                        <h2 class="header-name">Alberto Aday.</h2>
                        <h2 class="header-rest">I build on the web.</h2>
                        <p>I'm an aspiring software engineer. I like to build<br>websites. Back-end development is currently <br>progress.</p>
                    </div>
                </section>



                <section id="about">
                    <div class="about-section">
                        <h1>About me.</h1>
                    </div>
                </section>



                <section id="work">
                    <div class="work-section">
                        <h1>Work</h1>
                    </div>
               </section>



                <section id="contact">
                    <div class="contact-section">
                        <h1>Contact</h1>
                    </div>
                </section>



            </div>

    

I went ahead and removed the massive margins, which yes, did change the position of where things were but also created a ton of whitespace.

.container {
    width: 100%;
    height: 100%;
    background: #12182b;}

    .me-section {
    text-align: left;
    padding-left: 850px; }

 
    .me-section h1 {
    color: #6dffe7;
    font-size: 20px;
    margin: 0px;}

    .about-section {
    text-align: left; }

    .about-section h1 {
    color: #6dffe7;
    font-size: 20px;}
 <div class="container">
        <img src="logo.png" class="logo">

            <div class="header">
                <nav class="navbar">
                    <ul>
                        <div class="download-btn">
                            <li><a href="#about" class="about-2">About</a></li>
                            <li><a href="#work" class="work-3">Work</a></li>
                            <li><a href="#contact" class="contact-4">Contact</a></li>
                            <li><a href="Alberto Aday Resume.docx" class="btn">Resume</a></li>
                        </div>
                    </ul>
                </nav>



                <section id="me">
                    <div class="me-section">
                        <h1 class="my-name-after">Hi, my name is</h1>
                        <h2 class="header-name">Alberto Aday.</h2>
                        <h2 class="header-rest">I build on the web.</h2>
                        <p>I'm an aspiring software engineer. I like to build<br>websites. Back-end development is currently <br>progress.</p>
                    </div>
                </section>



                <section id="about">
                    <div class="about-section">
                        <h1>About me.</h1>
                    </div>
                </section>



                <section id="work">
                    <div class="work-section">
                        <h1>Work</h1>
                    </div>
               </section>



                <section id="contact">
                    <div class="contact-section">
                        <h1>Contact</h1>
                    </div>
                </section>



            </div>

    

£烟消云散 2025-01-30 16:51:29

问题是您的身高:

.me-section {
  text-align: left;
  padding-left: 850px; 
  height: 100vh; /* <-------------- */
  margin-top: 320px;
}

将其更改为50或60,看起来好多了!

The issue is your height:

.me-section {
  text-align: left;
  padding-left: 850px; 
  height: 100vh; /* <-------------- */
  margin-top: 320px;
}

Changing it to 50 or 60 it looked a lot better!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文