Html 与flexbox建立快速响应的产品组合/联系

Html 与flexbox建立快速响应的产品组合/联系,html,css,flexbox,responsive,Html,Css,Flexbox,Responsive,我正在从头开始建立一个单页的投资组合和联系人网站,在移动版本中看起来不错。 我正在努力使它看起来像平板电脑和台式机版本的预期 目前,移动版的特点是在下面有一个公文包部分,上面有缩略图和文本(在移动视图中,它只显示2个项目,但在平板电脑和桌面上应该是8个),一个在另一个下面。带有照片、介绍文字、表单和社交图标的联系人部分 我仍在开发平板电脑视图 我最大的问题是: 平板电脑视图 公文包:虽然8个项目成功地显示在2列/4行上,但它们在左侧稍微对齐。如果我设法使缩略图居中对齐,文本/描述也居中对齐,但它

我正在从头开始建立一个单页的投资组合和联系人网站,在移动版本中看起来不错。 我正在努力使它看起来像平板电脑和台式机版本的预期

目前,移动版的特点是在下面有一个公文包部分,上面有缩略图和文本(在移动视图中,它只显示2个项目,但在平板电脑和桌面上应该是8个),一个在另一个下面。带有照片、介绍文字、表单和社交图标的联系人部分

我仍在开发平板电脑视图

我最大的问题是:

平板电脑视图

  • 公文包:虽然8个项目成功地显示在2列/4行上,但它们在左侧稍微对齐。如果我设法使缩略图居中对齐,文本/描述也居中对齐,但它应该显示在左侧,与当前一样

  • Contacts:Contacts中的图像和简介文本也出现了类似的问题:稍微向左对齐。虽然平板视图应该保持移动视图,即图像和插入在顶部,在中间形成,在底部的社会图标,在平板上,特别是,形状太宽,这就是为什么我设置宽度,但我不确定这是否是正确的方法。

  • 所有拇指都有一个类,因为我希望它们根据设备调整大小。 但是我担心我通过尝试不同的方法和解决方案来在中间的某个地方弄乱代码。 编辑10/29/20:实际上,我通过更改一些代码块修复了公文包部分,比如从图像中删除“thumb”类。

    我现在最大的问题是:

    平板电脑视图:

  • 联系人部分仍然混乱:其目的仍然是在移动视图中显示一个div,另一个div下显示,但它太宽,对齐错误,社交图标显示在不应该显示的位置

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

  • 桌面视图:

  • 徽标和导航过去显示在同一行上,但现在不再是这样了,导航显示在右侧,但略低于右侧

  • 联系人部分在这里也很混乱:3个div显示在彼此的右边,而它们应该在左侧显示2个div,在右侧显示1个div(较大/较长,即带有表单的div)

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

  • 这是当前代码:

       /* 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;
      }
    
    /*通用样式*/
    html,
    身体{
    保证金:0;
    填充:0;
    框大小:边框框;
    }
    html{
    字体大小:16px;
    }
    身体{
    字体:400 1em“Roboto”,Arial,无衬线;
    颜色:#bfbf;
    背景:#262526;
    填充:0;
    保证金:0自动;
    }
    .集装箱{
    宽度:90%;
    保证金:0自动;
    填充:0;
    }
    h1,
    h2,
    h3{
    字体系列:“Playfair显示”,衬线;
    保证金:0;
    填充:0;
    }
    h4,
    h5,
    h6{
    字体系列:“Roboto”,无衬线;
    保证金:0;
    填充:0;
    }
    ul,
    ol{
    列表样式类型:无;
    保证金:0;
    填充:0;
    }
    a{
    字体大小:粗体;
    颜色:#ED8E82;
    文字装饰:无;
    }
    a:悬停,
    a:主动的{
    颜色:#bfbf;
    }
    img{
    宽度:100%;
    }
    .上段{
    背景:#262526;
    显示器:flex;
    证明内容:中心;
    对齐项目:居中;
    柔性流:行换行;
    }
    中段{
    背景:#4A484A;
    }
    .底部部分{
    背景#f2f2;
    }
    /*基本页眉-页脚样式*/
    标题{
    显示器:flex;
    证明内容:中心;
    对齐项目:居中;
    柔性流:行换行;
    保证金:0自动;
    文本对齐:居中;
    弹性基准:100%;
    }
    标题。标志a{
    字体:400普通1.25em“Playfair显示器”,衬线;
    颜色:#bfbf;
    文本转换:大写;
    线高:2.109375em;
    高度:50px;
    保证金:0;
    }
    页脚{
    保证金:0自动;
    宽度:100%;
    }
    页脚p{
    保证金:0;
    }
    .版权所有{
    字号:0.875em;
    颜色:#bfbf;
    文本对齐:居中;
    利润率:20px0;
    }
    /*----移动式--*/
    /*航行*/
    标题导航{
    填充:40px0;
    显示器:flex;
    证明内容:中心;
    对齐项目:居中;
    弹性基准:100%;
    }
    标题导航ul{
    保证金:0;
    填充:0;
    }
    标题nav ul li{
    填充:10px0;
    线高:2.109375em;
    }
    标题nav ul li a{
    字体:400普通1em“Roboto”,无衬线;
    颜色:#bfbf;
    文本转换:大写;
    文字装饰:无;
    文本对齐:居中;
    位置:相对位置;
    垫底:5px;
    }
    标题导航ul li a:悬停,
    收割台导航ul li a:激活{
    颜色:#ED8E82;
    }
    p{
    字号:1em;
    线高:1.25em;
    }
    /*关于*/
    .关于我{
    边缘底部:130像素;
    }
    .关于我h3{
    字体大小:粗体;
    字号:1.875em;
    颜色:#ED8E82;
    线高:1米;
    填充:25px0;
    }
    .关于我{
    颜色:#bfbf;
    }
    .关于我{
    字号:1.25em;
    }
    /*投资组合*/
    .投资组合{
    显示器:flex;
    柔性包装:包装;
    证明内容:中心;
    }
    #投资组合{
    填充:65px 0 80px;
    }
    #投资组合h3{
    字体大小:粗体;
    字号:1.875em;
    字体:斜体;
    颜色:#ED8E82;
    线高:1.25em;
    边缘底部:65px;
    宽度:100%;
    文本对齐:居中;
    }
    .工作{
    显示器:flex;
    填充:0.5em;
    宽度:100%;
    }
    .投资组合h6{
    字号:1em;
    字体:斜体;
    线高:1.0625em;
    颜色:#F2F2;
    边际上限:0;
    边缘底部:0.4em;
    }
    。请参阅更多链接{
    文本对齐:居中;
    边缘顶部:30px;
    }
    .移动式酒店{
    显示:无;
    }
    /*接触*/
    .联系人{
    显示器:flex;
    柔性包装:包装;
    }
    #接触{
    填充:65px 0 80px;
    }
    #联系人h3{
    字体大小:粗体;
    字号:1.875em;
    字体:斜体;
    颜色:#ED8E82;
    线高:1.25em;
    边缘底部:65px;
    wi
    
     <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>