溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

web開發(fā)中如何實(shí)現(xiàn)響應(yīng)式布局

發(fā)布時間:2021-09-14 11:01:41 來源:億速云 閱讀:112 作者:小新 欄目:web開發(fā)

這篇文章給大家分享的是有關(guān)web開發(fā)中如何實(shí)現(xiàn)響應(yīng)式布局的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

響應(yīng)式布局

響應(yīng)式布局在面對不同分辨率設(shè)備靈活性強(qiáng),在平時的網(wǎng)頁設(shè)計中基本上都要用到響應(yīng)式布局設(shè)計,它給我們提供了良好的用戶瀏覽頁面,能帶給我們更好的客戶體驗(yàn),下面給大家分享下我做的一個簡單的響應(yīng)式的布局:

web開發(fā)中如何實(shí)現(xiàn)響應(yīng)式布局

web開發(fā)中如何實(shí)現(xiàn)響應(yīng)式布局

不同的頁面會適用不同大小瀏覽器頁面,它會隨著分辨率的變化而變化。代碼展示如下:

<!DOCTYPE html>    
<html>    
<head>    
<meta charset="utf-8" />    
<title></title>    
<style>    
  p{    
    font-size: 12px;    
  }    
  header{    
    width: 100%;    
  }    
  header img{    
    width: 100%;    
  }    
  @media (min-width: 1300px) and (max-width:1400px) {    
    #left{    
      float: left;    
      width: 30%;    
      margin: 0px 50px;    
    }    
    #left #logo-bg{    
      margin: 10% 10%;    
      width: 80%;    
      position: relative;    
    }    
    #left #logo{    
      float: left;    
      width: 12%;    
      position: absolute;    
      left: 13%;    
      top: 230px;    
    }    
    #left p{    
      margin-bottom: -20px;    
    }    
    #left p,h5{    
      text-align: center;    
      color: red;    
    }    
    #right{    
      float: left;    
      width: 60%;    
      margin: 15% 0px;    
    }    
    #right h3{    
      text-align: center;    
    }    
    #right fieldset{    
      text-align: center;    
      border-left: none;    
      border-right: none;    
      border-bottom: none;    
    }    
    #right fieldset legend{    
      padding: 0px 20px;    
    }    
    #fen{    
      width: 100%;    
      -webkit-column-count: 6;    
      -moz-column-count: 6;    
      -o-column-count: 6;    
      -ms-column-count: 6;    
      column-count: 6;    
      -webkit-column-gap: 1em;    
      -moz-column-gap: 1em;    
      -o-column-gap: 1em;    
      -ms-column-gap: 1em;    
      column-gap: 1em;    
    }    
    #fen img{    
      width: 100%;    
      border-radius: 10px 10px 10px 10px;    
    }    
    #fen p,h5{    
      text-align: center;    
      color: red;    
    }    
    #fen p{    
      margin-bottom: -20px;    
    }    
    #di p{    
      text-align: center;    
    }    
    #di p span{    
       color: red;    
    }    
  }    
  @media (min-width: 1000px) and (max-width:1300px){    
    #left{    
      float: left;    
      width: 30%;    
      margin: 0px 50px;    
    }    
    #left #logo-bg{    
      margin: 10% 10%;    
      width: 80%;    
      position: relative;    
    }    
    #left #logo{    
      width: 12%;    
      position: absolute;    
      left: 14%;    
      top: 190px;    
    }    
    #left p{    
      margin-bottom: -20px;    
    }    
    #left p,h5{    
      text-align: center;    
      color: red;    
    }    
    #right{    
      float: left;    
      width: 60%;    
      margin: 15% 0px;    
    }    
    #right h3{    
      text-align: center;    
    }    
    #right fieldset{    
      text-align: center;    
      border-left: none;    
      border-right: none;    
      border-bottom: none;    
    }    
    #right fieldset legend{    
      padding: 0px 20px;    
    }    
    #fen{    
      width: 100%;    
      -webkit-column-count: 3;    
      -moz-column-count: 3;    
      -o-column-count: 3;    
      -ms-column-count: 3;    
      column-count: 3;    
      -webkit-column-gap: 1em;    
      -moz-column-gap: 1em;    
      -o-column-gap: 1em;    
      -ms-column-gap: 1em;    
      column-gap: 1em;    
    }    
    #fen img{    
        width: 100%;    
        border-radius: 10px 10px 10px 10px;    
    }    
    #fen p,h5{    
        text-align: center;    
        color: red;    
      }    
    #fen p{    
        margin-bottom: -20px;    
    }    
    #di p{    
      text-align: center;    
    }    
    #di p span{    
      color: red;    
    }    
  }    
</style>    
</head>    
<body>    
  <header>    
    <img src="img/rag.png" />    
  </header>    
  <aside id="left">    
    <img src="img/logo-bg.png" id="logo-bg"/>    
    <img src="img/logo.png" id="logo" />    
    <hr />    
    <p>THE</p>    
    <h5>WEBLOCUE</h5>    
    <hr />    
    <p>THE</p>    
    <h5>WEBLOCUE</h5>    
    <hr />    
    <p>THE</p>    
    <h5>WEBLOCUE</h5>    
    <hr />    
  </aside>    
  <article id="right">    
    <h3>“Give me problems, give me work.”</h3>    
    <p>In the year 1878 I took dogree of Doctor of Medicline of the Unibertive of the London and problems to Netbody to go through the course,In the year 1878 I took dogree of Doctor of Medicline of the Unibertive of the London and problems to Netbody to go through the course,In the year 1878 I took dogree of Doctor of Medicline of the Unibertive of the London and problems to Netbody to go through the course.</p>    
    <p>In the year 1878 I took dogree of Doctor of Medicline of the Unibertive of the London and problems to Netbody to go through the course,In the year 1878 I took dogree of Doctor of Medicline of the Unibertive of the London and problems to Netbody to go through the course,In the year 1878 I took dogree of Doctor of Medicline of the Unibertive of the London and problems to Netbody to go through the course.</p>    
    <fieldset><legend>victors</legend></fieldset>    
    <div id="fen">    
      <img src="img/1.jpg" />    
      <p>SETCOME</p>    
      <h5>HOLEMES</h5>    
      <img src="img/2.jpg" />    
      <p>SETCOME</p>    
      <h5>HOLEMES</h5>    
      <img src="img/3.jpg" />    
      <p>SETCOME</p>    
      <h5>HOLEMES</h5>    
      <img src="img/4.jpg" />    
      <p>SETCOME</p>    
      <h5>HOLEMES</h5>    
      <img src="img/5.jpg" />    
      <p>SETCOME</p>    
      <h5>HOLEMES</h5>    
      <img src="img/6.jpg" />    
      <p>SETCOME</p>    
      <h5>HOLEMES</h5>    
    </div>    
    <fieldset><legend>*</legend></fieldset>    
    <div id="di">    
      <p>In the year 1878 I took <span>Suing table</span> dogree of Doctor</p>    
      <p>What the year 2016 I took dogree <span>Ruing roid</span> of Doctor</p>    
    </div>    
  </article>    
</body>    
</html>

感謝各位的閱讀!關(guān)于“web開發(fā)中如何實(shí)現(xiàn)響應(yīng)式布局”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI