首页 > 解决方案 > 使用 flexbox 的响应式投资组合/联系人

问题描述

我正在从头开始构建一个在移动版本中看起来不错的单页投资组合和联系人网站。我正在努力让它在平板电脑和桌面版本中看起来像预期的那样。

目前,移动版有一个投资组合部分,下方有缩略图和文本(在移动视图中,它只会显示 2 个项目,但在平板电脑和台式机上应该是 8 个),一个在另一个之下。带有照片、一些介绍性文字、表格和社交图标的联系人部分。

我仍在研究平板电脑视图。

我最大的问题是以下几个:

平板电脑视图

  1. 作品集:虽然 8 个项目成功显示在 2 列/4 行上,但它们在左侧略微对齐。如果我设法使缩略图居中对齐,则文本/描述也居中对齐,但它应该像当前一样显示在左侧。

  2. 联系人:联系人中的图像和介绍文本也出现类似问题:略微向左对齐。虽然平板电脑视图应该保持移动视图,即顶部的图像和介绍,中间的表格,底部的社交图标,但在平板电脑上,特别是表格太宽,这就是为什么我设置宽度,但我不确定这是否是正确的方法。

所有拇指都有一个类,因为我希望它们根据设备调整大小。但我担心我通过尝试不同的方法和解决方案在中间的某个地方弄乱了代码。

编辑 10/29/20:我实际上通过更改一些代码块来修复投资组合部分,例如从图像中删除“thumb”类。

我现在最大的问题如下:

平板电脑视图:

  1. 联系人部分仍然一团糟:目的仍然是在另一个 div 下显示一个 div,就像在移动视图中一样,但是它太宽,对齐错误,并且社交图标出现在它们不应该出现的地方。

  2. 底部有一些空间,就在版权的正下方。

桌面视图:

  1. 徽标和导航过去显示在同一行,但现在不再如此,导航显示在右侧但略低于。

  2. 联系人部分在这里也搞砸了:3 个 div 彼此相邻显示,而它们应该在左侧显示 2 个 div 和 1 个 div(更大/更长,这是带有表单的那个)正确的。

  3. 就像在平板电脑视图中一样,底部有一些空间,版权正下方。

这是当前代码:

   /* General Style */
html,
body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


html {
    font-size: 16px;
}

body {
    font: 400 1em 'Roboto', Arial, sans-serif;
    color: #BFBFBF;
    background: #262526;
    padding: 0;
    margin: 0 auto;
}

.container {
    width: 90%;
    margin: 0 auto;
    padding: 0;
}

h1, 
h2,
h3 {
    font-family: 'Playfair Display', serif;
    margin: 0;
    padding: 0;
}

h4,
h5,
h6 {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
}

ul, 
ol {
    list-style-type: none;  
    margin: 0;
    padding: 0;
}

a {
    font-weight: bold;
    color: #ED8E82;
    text-decoration: none;
}

a:hover,
a:active {
    color: #BFBFBF;
}

img {
  width: 100%;
}

.topsection {
    background: #262526;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-flow: row wrap;
}

.middlesection {
    background: #4A484A;
}

.bottomsection {
    background: #F2F2F2;
}


/* Base Header - Footer Style */
header {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-flow: row wrap;
    margin: 0 auto;
    text-align: center;
    flex-basis: 100%;
}


header .logo a {
    font: 400 normal 1.25em 'Playfair Display', serif;
    color: #BFBFBF;
    text-transform: uppercase;
    line-height: 2.109375em;
    height: 50px;
    margin: 0;
}

footer {
    margin: 0 auto;
    width: 100%;
}


footer p {
    margin: 0;
}


.copyright {
    font-size: 0.875em;
    color: #BFBFBF;
    text-align: center;
    margin: 20px 0;
}

/* ---- MOBILE STYLE --- */



/* Navigation*/

header nav {
    padding: 40px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-basis: 100%;
}

header nav ul {
    margin: 0;
    padding: 0;
}

header nav ul li {
    padding: 10px 0;
    line-height: 2.109375em;
}

header nav ul li a {
    font: 400 normal 1em 'Roboto', sans-serif;
    color: #BFBFBF;
    text-transform: uppercase;
    text-decoration: none;
    text-align: center;
    position: relative;
    padding-bottom: 5px;
}

header nav ul li a:hover,
header nav ul li a:active {
    color: #ED8E82;
}

p {
    font-size: 1em;
    line-height: 1.25em;
}

/* About */

.about-me {
    margin-bottom: 130px;
}

.about-me h3{ 
    font-weight: bold;
    font-size: 1.875em;
    color: #ED8E82;
    line-height:  1em;
    padding: 25px 0;
}

.about-me span {
    color: #BFBFBF;
}

.about-me p {
    font-size: 1.25em;
}

/* Portfolio */

.portfolio {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

#portfolio {
    padding: 65px 0 80px;
}

#portfolio h3 {
    font-weight: bold;
    font-size: 1.875em;
    font-style: italic;
    color: #ED8E82;
    line-height:  1.25em;
    margin-bottom: 65px;
    width: 100%;
    text-align: center;
}

.work {
    display: flex; 
    padding: 0.5em;
    width: 100%;
}


.portfolio h6 {
    font-size: 1em;
    font-style: italic;
    line-height: 1.0625em;
    color: #F2F2F2;
    margin-top: 0;
    margin-bottom: 0.4em;
}

.seemore-link {
    text-align: center;
    margin-top: 30px;
}

.mobileHide {
    display: none;
}


/* Contacts */

.contacts {
    display: flex;
    flex-wrap: wrap;
}

#contacts {
    padding: 65px 0 80px;
}

#contacts h3 {
    font-weight: bold;
    font-size: 1.875em;
    font-style: italic;
    color: #ED8E82;
    line-height:  1.25em;
    margin-bottom: 65px;
    width: 100%;
    text-align: center;
}

.pic-cv {
    display: flex; 
    padding: 0.5em;
    width: 100%;
}

.pic-cv img {
    margin-bottom: 18px;
}

.piccv-text  span {
    color: #ED8E82;
}

.piccv-text  p {
    text-align: left;
    color: #262526; 
}

 .form {
    text-align: left;
    color: #262526;
    max-width:  25em;
    margin-bottom: 18px;
}

.form h6 {
    font-weight: bold;
    font-size: 1em;
    color: #ED8E82;
    line-height: 1.1875em;
    text-align: center;
    margin: 77px 0 25px;
}

.contacts input[type=email] {
    box-sizing: border-box;
    width: 100%;
    background: #fff;
    border: 1px solid #BFBFBF;
    padding: 1em;
    color: #BFBFBF;
    margin-bottom: 12px;
}

.contacts textarea {
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
    background: #fff;
    border: 1px solid #BFBFBF;
    padding: 1em;
    color: #BFBFBF;
    margin-bottom: 12px;
}

.contacts input[type=submit] {
  width: 100%;
  padding: 20px 0;
  margin-top: 20px;
  background-color: #ED8E82;
  font: 600 normal 1.125em 'Roboto', sans-serif;
  color: #F2F2F2;
  border: none;
  text-align: center;
  text-transform: uppercase;
}

.required:after {
    content:" *";
    color: #ED8E82;
  }

.pic-cv h6 {
    font-weight: bold;
    font-size: 1em;
    color: #ED8E82;
    line-height: 1.1875em;
    width: 100%;
    text-align: center;
    margin: 77px 0 25px;
}

.social-icons {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.social-icons p a {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #BFBFBF;
    color: #F2F2F2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 24px;
}

.social-icons p i {
    font-size: 1.3125em;
}

/* End Mobile Style */



/* Tablet Style */ /* 48em = 768px */

@media (min-width: 48em) {
    .mobileHide {
    display: block;
}

    /* About */
    
    .about-me {
    margin-top: 50px;   
    margin-bottom: 172px;
    }
    
    .about-me h3 { 
    width: 100%;
    font-size: 2.25em;
    }
    
    /* Portfolio */
    .work {
    flex: 0 1 47%;  
        
    }
        
    .seemore-link {
    visibility: hidden;
    }
    
    /* Contacts */
    .contacts {
    /*max-width: 38em;*/
    }
    
    .pic-cv {
    justify-content: center;
    align-items: center;
    flex-flow: row wrap; 
    max-width: 25em;
    }
    
    
   
}
        

/* Desktop Style */ /* 75em = 1200px */
@media (min-width: 75em) {
    
    /* Navigation */
    header {
        margin: 0 auto;
    }
    
    header .logo {
        text-align: left;
        flex-basis: 44%;
    }
    
    header nav {
        flex-basis: 44%;
        justify-content: flex-end;
    }
    
    header nav ul li {
        padding: 0 10px;
        display: inline;
    }
    
    header nav ul li a:hover,
    header nav ul li a:active {
    color: #BFBFBF;
    }

    header nav ul li a::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 3px;
    bottom: 0;
    left: 0;
    background-color: #ED8E82;
    visibility: hidden;
    transform: scaleX(0);
    transition: all 0.3s ease-in-out 0s;
    }

    header nav ul li a:hover::before {
    visibility: visible;
    transform: scaleX(1);
    }
    
    
    
    /* About */ 
    
    .about-me {
    margin-top: 250px;
    margin-bottom: 250px;   
    }
    
    .about-me p {
    width: 100%;
    }
    
    /* Portfolio */
    
    .portfolio img {
        
    filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */    
    -webkit-filter: grayscale(100%);
     -moz-filter: grayscale(100%);
     -ms-filter: grayscale(100%);
     filter: grayscale(100%);
     filter: gray; /* IE 6-9 */
    }
    
    img:hover {
    -webkit-filter: none;
    -moz-filter: none;
    -ms-filter: none;
        filter: none;
    }
    
    .work {
    width: 33.33%;
    }
    
    .work-text {
    display: flex;
    flex-direction: column;
    padding: 1em;
    width: 100%;
    }
    .work-text p {
    flex: 1 0 auto;
    }
    
    /* Contacts */
    
  .pic-cv {
    width: 30%;
  }

  .piccv-text {
   display: flex;
   flex-direction: column;
   padding: 1em;
   width: 100%;
   }
    
.piccv-text p {
   flex: 1 0 auto;
  }
 <body>
     <!-- Header / Navigation -->
        <header class="topsection">
            <div class="container">
                <div class="logo"><a href="">Logo name</a></div>
                    <nav>
                        <ul>
                             <li><a href="#about">About</a></li>
                             <li><a href="#portfolio">Portfolio</a></li>
                             <li><a href="#contacts">Contacts</a></li>
                        </ul>
                     </nav>
            </div><!-- Container ends here -->
        </header> <!-- Header / Navigation ends here -->
    
    
        <div class="topsection">
            <section class="about-me container" data-aos="fade-up" id="about">
                    <h3>Hello, this is <span>some text.</span> <br>I love text.</h3>
                    <p>Some more text.</p>
                    <p>And a lot of text.</p>
                </section>
        </div><!-- About ends here -->
        
    <div class="middlesection">
      <section id="portfolio" data-aos="fade-down" class="container">
          <h3>portfolio</h3>
          <ul class="portfolio">
          <li class="work">  
     <div class="work-text">    
      <h6>Project</h6>  
      <img src="image" alt="img" />  
      <p>Description</p>  
      <a href="" target="_blank">Link</a>  
    </div>  
  </li>  
  <li class="work">  
     <div class="work-text">    
      <h6>Project</h6>  
      <img src="image" alt="img" />  
      <p>Description</p>  
      <a href="" target="_blank">Link</a>  
    </div>  
  </li> 
         <li class="work">  
     <div class="work-text">    
      <h6>Project</h6>  
      <img src="image" alt="img" />  
      <p>Description</p>  
      <a href="" target="_blank">Link</a>  
    </div>  
  </li> 
  <li class="work">  
     <div class="work-text">    
      <h6>Project</h6>  
      <img src="image" alt="img" />  
      <p>Description</p>  
      <a href="" target="_blank">Link</a>  
    </div>  
  </li> 
         <li class="work">  
     <div class="work-text">    
      <h6>Project</h6>  
      <img src="image" alt="img" />  
      <p>Description</p>  
      <a href="" target="_blank">Link</a>  
    </div>  
  </li> 
         <li class="work">  
     <div class="work-text">    
      <h6>Project</h6>  
      <img src="image" alt="img" />  
      <p>Description</p>  
      <a href="" target="_blank">Link</a>  
    </div>  
  </li> 
     <li class="work">  
     <div class="work-text">    
      <h6>Project</h6>  
      <img src="image" alt="img" />  
      <p>Description</p>  
      <a href="" target="_blank">Link</a>  
    </div>  
  </li> 
         <li class="work">  
     <div class="work-text">    
      <h6>Project</h6>  
      <img src="image" alt="img" />  
      <p>Description</p>  
      <a href="" target="_blank">Link</a>  
    </div>  
  </li> 
</ul>
          
<!-- End hidden content -->
          <div class="seemore-link"><!-- Hidden only on tablet/desktop view-->
            <a href="portfolio.html">See more</a>
          </div>
        </section>
    </div>
        
        <footer class="bottomsection">
        <section id="contacts" class="container" data-aos="fade-right" >
            <h3>contacts</h3>
            <div class="contacts">
                <div class="pic-cv">
                    <div class="piccv-text">    
                     <img src="img/pic.jpg" alt="image" />  
                         <p>Have any question? Please get in touch.<br><span>Email:</span> thisemail@gmail.com</p>   
                     </div>  
                    </div>
                    <div id="form" class="form">
                      <h6>Ask Info</h6>
                        <form method="post" action="http://web-domain.com/cgi-bin/formmail.cgi" onsubmit="return checkform(this);">
                        <label class="required" for="email">Email:</label>
                        <input type="email" required="required" value="email address">
                        <label class="required" for="text">Message:</label>
                        <!--<input type="text" "required" value="message">-->
                        <textarea name="text" cols="48" rows="5" required="required">message</textarea> 
                            
                                        
                            <input type="submit" value="send"></form>
                        <!--Form ends here-->
                    </div>
                 <div class="pic-cv">  
                    <div id="socials" class="piccv-text">  
                        <h6>Social</h6>
                        <div class="social-icons">
                         <p><a href="link.com" target="_blank"><i class="icon"></i></a></p>
                                <p><a href="link.com" target="_blank"><i class="icon"></i></a></p>
                        </div>  
                    </div>
                </div> 
                </div>
                </section><!-- Contacts ends here -->
            <p class="copyright"> Copyright © Name and Last Name</p>
            
        </footer>


</body>

非常感谢您提供的任何帮助。

标签: htmlcssflexboxresponsive

解决方案


这段代码应该有帮助:

药片:

  1. 我添加了更多的弹性框来对齐中间的东西
  2. 我已经从页脚版权中删除了边距并用填充替换它

桌面:

  1. Flexbox 不适用于儿童,所以我将它应用到了他们身上

  2. 您应该为此使用网格,请参阅代码:)

/* General Style */

html,
body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font: 400 1em 'Roboto', Arial, sans-serif;
  color: #BFBFBF;
  background: #262526;
  padding: 0;
  margin: 0 auto;
}

.container {
  width: 90%;
  margin: 0 auto;
  padding: 0;
}

h1,
h2,
h3 {
  font-family: 'Playfair Display', serif;
  margin: 0;
  padding: 0;
}

h4,
h5,
h6 {
  font-family: 'Roboto', sans-serif;
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

a {
  font-weight: bold;
  color: #ED8E82;
  text-decoration: none;
}

a:hover,
a:active {
  color: #BFBFBF;
}

img {
  width: 100%;
}

.topsection {
  background: #262526;
}
.topsection > .container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-flow: row wrap;
}

.middlesection {
  background: #4A484A;
}

.bottomsection {
  background: #F2F2F2;
}


/* Base Header - Footer Style */

header {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-flow: row wrap;
  margin: 0 auto;
  text-align: center;
  flex-basis: 100%;
}

header .logo a {
  font: 400 normal 1.25em 'Playfair Display', serif;
  color: #BFBFBF;
  text-transform: uppercase;
  line-height: 2.109375em;
  height: 50px;
  margin: 50px 0 0 0;
}

footer {
  margin: 0 auto;
  width: 100%;
}

footer p {
  margin: 0;
}

.copyright {
  font-size: 0.875em;
  color: #BFBFBF;
  text-align: center;
  margin: 0;
  padding: 20px 0;
}


/* ---- MOBILE STYLE --- */


/* Navigation*/

header nav {
  padding: 40px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-basis: 100%;
}

header nav ul {
  margin: 0;
  padding: 0;
}

header nav ul li {
  padding: 10px 0;
  line-height: 2.109375em;
}

header nav ul li a {
  font: 400 normal 1em 'Roboto', sans-serif;
  color: #BFBFBF;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  position: relative;
  padding-bottom: 5px;
}

header nav ul li a:hover,
header nav ul li a:active {
  color: #ED8E82;
}

p {
  font-size: 1em;
  line-height: 1.25em;
}


/* About */

.about-me {
  margin-bottom: 130px;
}

.about-me h3 {
  font-weight: bold;
  font-size: 1.875em;
  color: #ED8E82;
  line-height: 1em;
  padding: 25px 0;
}

.about-me span {
  color: #BFBFBF;
}

.about-me p {
  font-size: 1.25em;
}


/* Portfolio */

.portfolio {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

#portfolio {
  padding: 65px 0 80px;
}

#portfolio h3 {
  font-weight: bold;
  font-size: 1.875em;
  font-style: italic;
  color: #ED8E82;
  line-height: 1.25em;
  margin-bottom: 65px;
  width: 100%;
  text-align: center;
}

.work {
  display: flex;
  padding: 0.5em;
  width: 100%;
}

.portfolio h6 {
  font-size: 1em;
  font-style: italic;
  line-height: 1.0625em;
  color: #F2F2F2;
  margin-top: 0;
  margin-bottom: 0.4em;
}

.seemore-link {
  text-align: center;
  margin-top: 30px;
}

.mobileHide {
  display: none;
}


/* Contacts */

.contacts {
  display: flex;
  flex-wrap: wrap;
  display: block; /* will be redifined as grid later on */
}

#contacts {
  padding: 65px 0 80px;
}

#contacts h3 {
  font-weight: bold;
  font-size: 1.875em;
  font-style: italic;
  color: #ED8E82;
  line-height: 1.25em;
  margin-bottom: 65px;
  width: 100%;
  text-align: center;
}

.pic-cv {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  padding: 0.5em;
  width: 100%;
}

.socials-outer {
  grid-column: 1;
  grid-row: 2;
}

.pic-cv img {
  margin-bottom: 18px;
}

.piccv-text span {
  color: #ED8E82;
}

.piccv-text p {
  text-align: left;
  color: #262526;
}

.form {
  grid-column: 2;
  grid-row: 1 / 3;
  text-align: left;
  color: #262526;
  margin: 0 auto;
}

.form h6 {
  font-weight: bold;
  font-size: 1em;
  color: #ED8E82;
  line-height: 1.1875em;
  text-align: center;
  margin: 77px 0 25px;
}

.contacts input[type=email] {
  box-sizing: border-box;
  width: 100%;
  background: #fff;
  border: 1px solid #BFBFBF;
  padding: 1em;
  color: #BFBFBF;
  margin-bottom: 12px;
}

.contacts textarea {
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
  background: #fff;
  border: 1px solid #BFBFBF;
  padding: 1em;
  color: #BFBFBF;
  margin-bottom: 12px;
}

.contacts input[type=submit] {
  width: 100%;
  padding: 20px 0;
  margin-top: 20px;
  background-color: #ED8E82;
  font: 600 normal 1.125em 'Roboto', sans-serif;
  color: #F2F2F2;
  border: none;
  text-align: center;
  text-transform: uppercase;
}

.required:after {
  content: " *";
  color: #ED8E82;
}

.pic-cv {
  display: flex;
  justify-content: center;
}

.pic-cv h6 {
  font-weight: bold;
  font-size: 1em;
  color: #ED8E82;
  line-height: 1.1875em;
  width: 100%;
  text-align: center;
  margin: 77px 0 25px;
}

.social-icons {
  grid-template-columns: 1;
  grid-template-rows: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
}

.social-icons p a {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #BFBFBF;
  color: #F2F2F2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin: 24px;
}

.social-icons p i {
  font-size: 1.3125em;
}
.copyright {
  margin: 0;
}


/* End Mobile Style */


/* Tablet Style */


/* 48em = 768px */

@media (min-width: 48em) {
  .mobileHide {
    display: block;
  }
  /* About */
  .about-me {
    margin-top: 50px;
    margin-bottom: 172px;
  }
  .about-me h3 {
    width: 100%;
    font-size: 2.25em;
  }
  /* Portfolio */
  .work {
    flex: 0 1 47%;
  }
  .seemore-link {
    visibility: hidden;
  }
  /* Contacts */
  .contacts {
    /*max-width: 38em;*/
    width: 100%;
    flex-direction: column;
    justify-content: center;
  }
  .pic-cv {
    justify-content: center;
    align-items: center;
    flex-flow: row wrap;
  }
}


/* Desktop Style */


/* 75em = 1200px */

@media (min-width: 75em) {
  /* Navigation */
  header {
    margin: 0 auto;
  }
  header .logo {
    text-align: left;
    flex-basis: 44%;
  }
  header nav {
    flex-basis: 44%;
    justify-content: flex-end;
  }
  header nav ul li {
    padding: 0 10px;
    display: inline;
  }
  header nav ul li a:hover,
  header nav ul li a:active {
    color: #BFBFBF;
  }
  header nav ul li a::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 3px;
    bottom: 0;
    left: 0;
    background-color: #ED8E82;
    visibility: hidden;
    transform: scaleX(0);
    transition: all 0.3s ease-in-out 0s;
  }
  header nav ul li a:hover::before {
    visibility: visible;
    transform: scaleX(1);
  }
  /* About */
  .about-me {
    margin-top: 250px;
    margin-bottom: 250px;
  }
  .about-me p {
    width: 100%;
  }
  /* Portfolio */
  .portfolio img {
    filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
    /* Firefox 10+, Firefox on Android */
    -webkit-filter: grayscale(100%);
    -moz-filter: grayscale(100%);
    -ms-filter: grayscale(100%);
    filter: grayscale(100%);
    filter: gray;
    /* IE 6-9 */
  }
  img:hover {
    -webkit-filter: none;
    -moz-filter: none;
    -ms-filter: none;
    filter: none;
  }
  .work {
    width: 33.33%;
  }
  .work-text {
    display: flex;
    flex-direction: column;
    padding: 1em;
    width: 100%;
  }
  .work-text p {
    flex: 1 0 auto;
  }
  /* Contacts */
  .contacts {
      display: grid;
  }
  .pic-cv {
    width: 30%;
  }
  .piccv-text {
    display: flex;
    flex-direction: column;
    padding: 1em;
    width: 100%;
  }
  .piccv-text p {
    flex: 1 0 auto;
  }
  .form {
    margin: 0;
  }
}
<body>
  <!-- Header / Navigation -->
  <header class="topsection">
    <div class="container">
      <div class="logo"><a href="">Logo name</a></div>
      <nav>
        <ul>
          <li><a href="#about">About</a></li>
          <li><a href="#portfolio">Portfolio</a></li>
          <li><a href="#contacts">Contacts</a></li>
        </ul>
      </nav>
    </div>
    <!-- Container ends here -->
  </header>
  <!-- Header / Navigation ends here -->


  <div class="topsection">
    <section class="about-me container" data-aos="fade-up" id="about">
      <h3>Hello, this is <span>some text.</span> <br>I love text.</h3>
      <p>Some more text.</p>
      <p>And a lot of text.</p>
    </section>
  </div>
  <!-- About ends here -->

  <div class="middlesection">
    <section id="portfolio" data-aos="fade-down" class="container">
      <h3>portfolio</h3>
      <ul class="portfolio">
        <li class="work">
          <div class="work-text">
            <h6>Project</h6>
            <img src="image" alt="img" />
            <p>Description</p>
            <a href="" target="_blank">Link</a>
          </div>
        </li>
        <li class="work">
          <div class="work-text">
            <h6>Project</h6>
            <img src="image" alt="img" />
            <p>Description</p>
            <a href="" target="_blank">Link</a>
          </div>
        </li>
        <li class="work">
          <div class="work-text">
            <h6>Project</h6>
            <img src="image" alt="img" />
            <p>Description</p>
            <a href="" target="_blank">Link</a>
          </div>
        </li>
        <li class="work">
          <div class="work-text">
            <h6>Project</h6>
            <img src="image" alt="img" />
            <p>Description</p>
            <a href="" target="_blank">Link</a>
          </div>
        </li>
        <li class="work">
          <div class="work-text">
            <h6>Project</h6>
            <img src="image" alt="img" />
            <p>Description</p>
            <a href="" target="_blank">Link</a>
          </div>
        </li>
        <li class="work">
          <div class="work-text">
            <h6>Project</h6>
            <img src="image" alt="img" />
            <p>Description</p>
            <a href="" target="_blank">Link</a>
          </div>
        </li>
        <li class="work">
          <div class="work-text">
            <h6>Project</h6>
            <img src="image" alt="img" />
            <p>Description</p>
            <a href="" target="_blank">Link</a>
          </div>
        </li>
        <li class="work">
          <div class="work-text">
            <h6>Project</h6>
            <img src="image" alt="img" />
            <p>Description</p>
            <a href="" target="_blank">Link</a>
          </div>
        </li>
      </ul>

      <!-- End hidden content -->
      <div class="seemore-link">
        <!-- Hidden only on tablet/desktop view-->
        <a href="portfolio.html">See more</a>
      </div>
    </section>
  </div>

  <footer class="bottomsection">
    <section id="contacts" class="container" data-aos="fade-right">
      <h3>contacts</h3>
      <div class="contacts">
        <div class="pic-cv">
          <div class="piccv-text">
            <img src="img/pic.jpg" alt="image" />
            <p>Have any question? Please get in touch.<br><span>Email:</span> thisemail@gmail.com</p>
          </div>
        </div>
        <div id="form" class="form">
          <h6>Ask Info</h6>
          <form method="post" action="http://web-domain.com/cgi-bin/formmail.cgi" onsubmit="return checkform(this);">
            <label class="required" for="email">Email:</label>
            <input type="email" required="required" value="email address">
            <label class="required" for="text">Message:</label>
            <!--<input type="text" "required" value="message">-->
            <textarea name="text" cols="48" rows="5" required="required">message</textarea>
            
            <input type="submit" value="send"></form>
          <!--Form ends here-->
        </div>
        <div class="pic-cv socials-outer">
          <div id="socials" class="piccv-text">
            <h6>Social</h6>
            <div class="social-icons">
              <p><a href="link.com" target="_blank"><i class="icon"></i></a></p>
              <p><a href="link.com" target="_blank"><i class="icon"></i></a></p>
            </div>
          </div>
        </div>
      </div>
    </section>
    <!-- Contacts ends here -->
    <p class="copyright"> Copyright © Name and Last Name</p>

  </footer>


</body>


推荐阅读