CSS网格系统或媒体查询

时间:2018-10-25 12:36:57

标签: javascript html css

我不确定是否应该使用网格系统或(https://medium.freecodecamp.org/how-to-make-your-html-responsive-by-adding-a-single-line-of-css-2a62de81e431)或媒体查询。

我发现侧面菜单栏以及底部的特色产品对笔记本计算机的宽度都有影响。

我不确定css网格是否会有所帮助,因为我更加关注菜单栏如何相互播放,但彼此之间保持正确的关系。不确定如何解决此问题。

 <!DOCTYPE html>
    <html>
    <head>
    <title>Healthy Hair Beauty Supply</title>
      <style>body {
      background: url('https://thumbs.dreamstime.com/b/red-gold-background-frame-roses-vector-79285044.jpg') no-repeat;
      font-family: Apple Chancery, cursive;
      font-style: italic;
      color: gold;
      background-size: cover;
      opacity: .81;
    }
    section {
      background-color: #1b0007;
box-shadow: 6px 6px 2px 1px #FFEF99;
      opacity: .8;
      padding: 10px;
      float: right;
      border-radius: 25px;
      margin-right: 20px;
      margin-bottom: 2px;
      color: white;
    width:160px;
    height:160px;
    }
    ul  {
      margin: 0px;
      padding: 0px;
      list-style: none;
    }
    ol {list-style:none;
    width:200px;            
    }
    ul li {
      box-shadow: 6px 6px 2px 1px #FFEF99;
      border-radius: 5px;
      float: right;
      width: 240px;
      height: 40px;
      background-color: black;
      opacity: .4;
      line-height: 40px;
      text-align: center;
      font-size: 20px;
      margin-right: 8px;
    }
    ul li a {
      text-decoration: none;
      color: gold;
    }
    ul li a:hover {
      background-color: red;
      display: block;
      border-radius: 5px;
    }
    ul li ul li {
      display: none;
    }
    ul li:hover ul li {
      display: block;
    }
    h1 {
      color: #34000d;
      font-size: 40px;
      padding: 60px;
      box-shadow: 12px 12px 2px 1px #34000d;
      text-align: center;
      Opacity: .7;
      background: url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxISEhUQEhIVFRUVFRUPFRUVFRUVFRUPFRUWFhUVFRUYHyggGBolHRUVITEhJSkrLi4uFx8zODMtNygtLisBCgoKDg0OGg8QFy0dHR0tLS0tLS0tLS0tLS0t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+Jq5h58qnj7Rqxm4hI2ylitj5YnvZZfoqzfA9duLxP8AYmqV8VZ1KTFYh7XF8Yj32//Z') no-repeat;
      background-size: cover;
      border-radius: 15px;
    }
    span {
      text-align: center;
    }
    .engraved {
      font-size: 100px;
      font-family: Futura;
      background-color: #000000;
      -webkit-background-clip: text;
      -moz-background-clip: text;
      background-clip: text;
      color: transparent;
      text-shadow: rgba(245, 245, 245, 0.5) 3px 5px 1px;
    }
    .embossed {
      color: #f0f0f0;
      font-size: 100px;
      font-family: Futura;
      background-color: #666666;
              text-shadow: 1px 4px 4px #555;
              text-align: center;
              -webkit-background-clip: text;
              -moz-background-clip: text;
              }
            </style>
            </head>
              <body>
                <ul>
                  <li style="width: 140px;font-size:small;"><a>Affliates</a></li>
        </ul>
        <ul>
          <li style="width: 140px;font-size:small;"><a>About Us</a>
            <ul>
              <li style="width: 140px;font-size:small;"><a>Testimonial</a></li>
            </ul>
          </li>
        </ul>
        <ul>
          <li style="width: 140px;font-size:small;"><a>Contact Us</a>
            <ul>
              <li style="width: 140px;font-size:small;"><a>Contact Us</a></li>
            </ul>
          </li>
          <ul>
            <li style="width: 140px;font-size:small;"><a>Reviews</a>
              <ul>
                <li style="width: 140px;font-size:small;"><a>Youtube</a></li>
              </ul>
            </li>
             <ul>
          <li style="width: 140px;font-size:small;"><a>Hair Growth </a>
            <ul>
             <li style="width: 140px;font-size:small;"><a>OIL</a></li>
            </ul>
          </li>
          <ul>
            <li style="width: 140px;font-size:small;"><a>Home</a>                  
            </li>               
              <br><br><br>
              <span class="engraved">
                <h1 style="font-size:85%;">
    Healthy Hair Beauty Supply
    </h1></span>
    <div class="banner"><a href="https://www.affilorama.com/5stepformula?aff=clarissagr"><img src="https://cdn.affilorama.com/files/image/affiliates/resources/affilojetpack/banner/72890-A.png" style="width:100%;display:grid;"></a></div>
    <br><br>
    <br>
    <section style="width:800px; height:275px;left:100px; display: grid;">What is Lorem Ipsum?
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</section>
    <ol>
    <li style="font-size:85%;background-color: #1b0007;
      opacity: .8;">black hair care products</li>
    <li style="font-size:85%;background-color: #1b0007;
      opacity: .8;">black hair care growth products</li>
    <li style="font-size:85%;background-color: #1b0007;
      opacity: .8;">black hair care growth oil product</li>
    <li style="font-size:85%;background-color: #1b0007;
      opacity: .8;">black hair care natural hair blog</li>
    <li style="font-size:85%;background-color: #1b0007;
      opacity: .8;">black hair care blog</li>
    <li style="font-size:85%;background-color: #1b0007;
      opacity: .8;">black hair care forum</li>
    <li style="font-size:85%;background-color: #1b0007;
      opacity: .8;">black hair care product development</li>
    <li style="font-size:85%;background-color: #1b0007;
      opacity: .8;">black hair care reviews</li>
    </ol>                             
              </div>
    <div style="position: relative;
    top: 100px; right:850px;">
         <section>  
        <h2 style="font-size:70%;">
           Featured Healthy Hair Product
        </h2>
        <p>
          <div class="product">
            <a href="#" class="img"><img src="http://www.hydrathermanaturals.com/DSN/wwwhydrathermanaturalscom/Commerce/productimages/tmb1_000018.jpg"/style="width:80px; height:80px;" ></a>                
            </div>
            <div style="font-size:25%;"><a href="#" class="name">Hair Product</a>
            <div>
              $19.00
            </div>
            <a href="#" class="cart">Shopping Cart</a>
            <span>1</span>                
    </p>
    </div>
    </section>
          </div>
          </div>
    <div style="position: relative;right:350px;top:100px;">
    <section>
             <h2 style="font-size:70%">
           Featured Healthy Hair Product
        </h2>
        <p>
          <div class="product">
            <a href="#" class="img"><img src="http://www.hydrathermanaturals.com/DSN/wwwhydrathermanaturalscom/Commerce/productimages/tmb1_000018.jpg"/style="width:80px; height:80px;" ></a>                              
            </div>
            <div style="font-size:25%;"><a href="#" class="name">Hair Product</a>
            <div>
              $19.00
            </div>
            <a href="#" class="cart">Shopping Cart</a>
            <span>1</span>                
    </p>
    </section>
          </div>
    </div>         
      </body>
    </html>

3 个答案:

答案 0 :(得分:0)

我总是建议使用css-grid,它用途广泛,并且在您初次使用它时可以节省很多时间,我建议您阅读文档和/或一些教程。

这是一个教程,向您展示GRID的主要功能: https://css-tricks.com/snippets/css/complete-guide-grid/

这是一个有动机的游戏 http://cssgridgarden.com/

答案 1 :(得分:0)

我在这里找到了答案:

https://www.codecademy.com/en/forum_questions/532619b28c1ccc0cac002730

  

...”好吧,简单的解决方案是这样的:   身体 {   填充:0;   边距:0;”   }

答案 2 :(得分:0)

我认为对于响应式设计,即使使用CSS网格,您仍然必须使用媒体查询。我使用过CSS网格,仍然必须使用媒体查询来更改网格在不同视口大小下的显示方式。