media頁面配置2

來源:互聯網
上載者:User

標籤:

一個三欄布局的,在不同的尺寸下,變為兩欄,再變為一欄

代碼如下: 查看代碼列印? 01 <!DOCTYPE HTML> 

02 <html> 

03 <head> 

04 <meta charset="utf-8"> 

05 <meta name="viewport" content="width=device-width, initial-scale=1" /> 

06 <title>css3-media-queries-demo</title> 

07 <style> 

08 body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, textarea, p, blockquote, th, td { 

09     padding: 0; 

10     margin: 0; 

11 } 

12 .content{ 

13     zoom:1; 

14 } 

15 .content:after{ 

16     content: "."; 

17     display: block; 

18     height: 0; 

19     clear: both; 

20     visibility: hidden;  

21 } 

22 .leftBox, .rightBox{ 

23     float: left; 

24     width: 20%; 

25     height: 500px; 

26     margin: 5px; 

27     background: #ffccf7; 

28     display: inline; 

29     -webkit-transition: width 1s ease; 

30     -moz-transition: width 1s ease; 

31     -o-transition: width 1s ease; 

32     -ms-transition: width 2s ease; 

33     transition: width 1s ease; 

34 } 

35 .middleBox{ 

36     float: left; 

37     width: 50%; 

38     height: 800px; 

39     margin: 5px; 

40     background: #b1fffc; 

41     display: inline; 

42     -webkit-transition: width 1s ease; 

43     -moz-transition: width 1s ease; 

44     -o-transition: width 1s ease; 

45     -ms-transition: width 1s ease; 

46     transition: width 1s ease; 

47 } 

48 .rightBox{ 

49     background: #fffab1; 

50 } 

51 @media only screen and (min-width: 1024px){ 

52     .content{ 

53             width: 1000px; 

54             margin: auto 

55         } 

56 } 

57 @media only screen and (min-width: 400px) and (max-width: 1024px){ 

58     .rightBox{ 

59         width: 0; 

60     } 

61     .leftBox{ width: 30%} 

62     .middleBox{ width: 65%} 

63 } 

64 @media only screen and (max-width: 400px){ 

65     .leftBox, .rightBox, .middleBox{  

66         width: 98%; 

67         height: 200px; 

68     } 

69 } 

70 </style> 

71 </head> 

72   

73 <body> 

74 <div class="content"> 

75   <div class="leftBox"></div> 

76   <div class="middleBox"></div> 

77   <div class="rightBox"></div> 

78 </div> 

79 </body> 

80 </html> 本文來自:我愛模板網(www.5imoban.net) 詳細出處參考:http://www.5imoban.net/jiaocheng/div+css/2014/0311/312.html

media頁面配置2

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.