頁面布局

頁面布局兩大類:
  主站:

1 <div class='pg-header'>
2     <div style='width:980px;margin:0 auto;'>
3                 內容自動居中
4     </div>
5 <div class='pg-content'></div>
6 <div class='pg-footer'></div>    
View Code

  后臺管理布局:

    position:
      fixed ==> 永遠固定在窗口的某個位置
      relative ==> 單獨無意義
      absolute ==> 單獨使用,第一次定位,可以在指定位置,滾輪滾動時,不在原來的指定位置(overflow:auto)
    a.?左側菜單不動,頁面固定,內容跟隨滾動條滾動
    b.?左側菜單以及內容不動
實例1:用position:fixed實現;

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>Title</title>
 6     <style>
 7         .left{
 8             float:left;
 9         }
10         .pg-body .menu{
11             position: fixed;
12             top:48px;
13             left:0;
14             bottom:0;
15             width: 200px;
16             background-color: #dddddd;
17         }
18         .pg-body .content{
19             position: fixed;
20             top:48px;
21             right: 0;
22             bottom: 0;
23             left:200px;
24             background-color: purple;
25             overflow: auto;
26 
27         }
28         body{
29             margin: 0;
30         }
31         .pg-header{
32             height: 48px;
33             background-color: blue;
34             color: white;
35         }
36     </style>
37 </head>
38 <body>
39     <div class="pg-header"></div>
40     <div class="pg-body">
41         <div class='menu left'>caidanlan
42 
43         </div>
44         <div class='content left'>content
45             <p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>
46             <p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>
47             <p>1</p><p>1</p>
48 
49         </div>
50     </div>
51     <div class="pg-footer"></div>
52 
53 </body>
54 </html>
View Code

?

實例2:用position:absolute實現(注意,用該方法實現的頁面,僅需更改overflow屬性即可完成兩種頁面布局的切換)

  1 <!DOCTYPE html>
  2 <html lang="en">
  3 <head>
  4     <meta charset="UTF-8">
  5     <title>Title</title>
  6     <style>
  7         .left{
  8             float:left;
  9         }
 10         .right{
 11             float:right;
 12         }
 13         .pg-body .menu{
 14             position: absolute;
 15             top:48px;
 16             left:0;
 17             bottom:0;
 18             width: 200px;
 19             background-color: #dddddd;
 20         }
 21         .pg-body .content{
 22             position: absolute;
 23             top:48px;
 24             right: 0;
 25             bottom: 0;
 26             left:200px;
 27             z-index:9;
 28             background-color: purple;
 29             overflow: auto;  <!--核心屬性,這個屬性的變更可以出現兩種情況的后臺管理界面-->
 30             min-width:px;
 31         }
 32 
 33         body{
 34             margin: 0;
 35         }
 36         .pg-header{
 37             height: 48px;
 38             background-color: blue;
 39             color: white;
 40             line-height:48px;
 41             text-align:center;
 42         }
 43         .pg-header .logo{
 44             width:200px;
 45             background-color: cadetblue;
 46         }
 47         .pg-header .user{
 48             width:160px;
 49             background-color: wheat;
 50             position:relative;
 51         }
 52         .pg-header .user .a img{
 53             width: 48px;height:48px;border-radius: 50%;
 54         }
 55         .pg-header .user:hover{
 56             background-color: aquamarine;
 57 
 58         }
 59         .pg-header .user:hover .b{
 60             display: block;
 61 
 62         }
 63 
 64         .pg-header .user .b{
 65             position:absolute;
 66             top:48px;
 67             z-index:10;
 68             background-color:greenyellow;
 69             width:160px;
 70             display: none;
 71 
 72         }
 73         .pg-header .user .b a{
 74             display: block;
 75             text-align: left;
 76 
 77         }
 78     </style>
 79 </head>
 80 <body>
 81     <div class="pg-header">
 82         <div class="logo left">老男孩</div>
 83         <div class="user right">
 84             <a class='a' href="http://www.baidu.com">
 85             <img src="userpic.jpg"/>
 86             </a>
 87             <div class="b">
 88                 <a>我的資料</a>
 89                 <a>注銷</a>
 90             </div>
 91         </div>
 92     </div>
 93     <div class="pg-body">
 94         <div class='menu left'>caidanlan
 95 
 96         </div>
 97         <div class='content left'>content
 98             <p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>
 99             <p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>
100             <p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>
101             <p>1</p><p>1</p>
102         </div>
103     </div>
104     <div class="pg-footer"></div>
105 
106 </body>
107 </html>
View Code

?

  調用圖標:
    目前一般都調用在線資源,如http://www.fontawesome.com.cn/
    調用方法為,將文件全部下載解壓到開發目錄,在html中:
      <link rel='stylesheet' href='font-awesome-4.7.0/css/font-awesome.min.css'/>
    其中,一般都是使用壓縮版的css(font-awesome.min.css);
    font-awesome.min.css和font-awesome.css之間的差別在于,壓縮版的里面的每個樣式的css代碼都是一行。
    調用其中某個樣式的寫法均從其官網可以找到,如:

1 <div class='a'>
2 <i class='fa fa-superpowers' aria-hidden='true'></i>
3 </div>
View Code

?

轉載于:https://www.cnblogs.com/zoe233/p/7502453.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/391405.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/391405.shtml
英文地址,請注明出處:http://en.pswp.cn/news/391405.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

sonar:默認的掃描規則

https://blog.csdn.net/liumiaocn/article/details/83550309 https://note.youdao.com/ynoteshare1/index.html?id3c1e6a08a21ada4dfe0123281637e299&typenote https://blog.csdn.net/liumiaocn/article/details/83550309 文本版&#xff1a; soanr規則java版 …

多變量線性相關分析_如何測量多個變量之間的“非線性相關性”?

多變量線性相關分析現實世界中的數據科學 (Data Science in the Real World) This article aims to present two ways of calculating non linear correlation between any number of discrete variables. The objective for a data analysis project is twofold : on the one …

wp博客寫文章500錯誤_500多個博客文章教我如何撰寫出色的文章

wp博客寫文章500錯誤Ive written a lot of blog posts. Somewhere north of 500 to be exact. All of them are technical. 我寫了很多博客文章。 確切地說是在500以北的某個地方。 所有這些都是技術性的。 About two dozen of them are actually good. 實際上大約有兩打是不錯…

leetcode 220. 存在重復元素 III(排序)

給你一個整數數組 nums 和兩個整數 k 和 t 。請你判斷是否存在 兩個不同下標 i 和 j&#xff0c;使得 abs(nums[i] - nums[j]) < t &#xff0c;同時又滿足 abs(i - j) < k 。 如果存在則返回 true&#xff0c;不存在返回 false。 示例 1&#xff1a; 輸入&#xff1a…

ON DUPLICATE KEY UPDATE

INSERT INTO ON DUPLICATE KEY UPDATE 與 REPLACE INTO&#xff0c;兩個命令可以處理重復鍵值問題&#xff0c;在實際上它之間有什么區別呢&#xff1f;前提條件是這個表必須有一個唯一索引或主鍵。1、REPLACE發現重復的先刪除再插入&#xff0c;如果記錄有多個字段&#xff0c…

os.path 模塊

os.path.abspath(path) #返回絕對路徑os.path.basename(path) #返回文件名os.path.commonprefix(list) #返回list(多個路徑)中&#xff0c;所有path共有的最長的路徑。os.path.dirname(path) #返回文件路徑os.path.exists(path) #路徑存在則返回True,路徑損壞返回Falseos.path…

探索性數據分析(EDA):Python

什么是探索性數據分析(EDA)&#xff1f; (What is Exploratory Data Analysis(EDA)?) If we want to explain EDA in simple terms, it means trying to understand the given data much better, so that we can make some sense out of it.如果我們想用簡單的術語來解釋EDA&a…

微服務框架---搭建 go-micro環境

1.安裝micro 需要使用GO1.11以上版本 #linux 下 export GO111MODULEon export GOPROXYhttps://goproxy.io # windows下設置如下環境變量 setx GO111MODULE on setx GOPROXY https://goproxy.io # 使用如下指令安裝 go get -u -v github.com/micro/micro go get -u -v github.co…

angular dom_Angular 8 DOM查詢:ViewChild和ViewChildren示例

angular domThe ViewChild and ViewChildren decorators in Angular provide a way to access and manipulate DOM elements, directives and components. In this tutorial, well see an Angular 8 example of how to use the two decorators.Angular中的ViewChild和ViewChild…

浪潮之巔——IT產業的三大定律

http://www.cnblogs.com/ysocean/p/7641540.html轉載于:https://www.cnblogs.com/czlovezmt/p/8325772.html

DStream算子講解(一)

先把目錄列好&#xff0c;方便有條理的進行整理轉載于:https://www.cnblogs.com/leodaxin/p/7507600.html

aws 靜態網站_如何使用AWS托管靜態網站-入門指南

aws 靜態網站When I created my first portfolio last year, I based it on what I had learned from freeCodeCamp (HTML, CSS and a little JavaScript). 去年創建我的第一個投資組合時 &#xff0c;我基于從freeCodeCamp (HTML&#xff0c;CSS和一些JavaScript)中學到的知識…

leetcode 27. 移除元素(雙指針)

給你一個數組 nums 和一個值 val&#xff0c;你需要 原地 移除所有數值等于 val 的元素&#xff0c;并返回移除后數組的新長度。 不要使用額外的數組空間&#xff0c;你必須僅使用 O(1) 額外空間并 原地 修改輸入數組。 元素的順序可以改變。你不需要考慮數組中超出新長度后面…

使用TVP批量插入數據

TVP&#xff08;全稱 :Table-Valued Parameter&#xff09; 叫做表值參數(Table-Valued Parameter)是SQL2008的一個新特性。顧名思義&#xff0c;表值參數表示你可以把一個表類型作為參數傳遞到函數或存儲過程里。 第一步&#xff1a;創建一個Type類型和寫入數據的原始表結構相…

python:找出兩個列表中相同和不同的元素(使用推導式)

#接口返回值 list1 [張三, 李四, 王五, 老二] #數據庫返回值 list2 [張三, 李四, 老二, 王七]a [x for x in list1 if x in list2] #兩個列表表都存在 b [y for y in (list1 list2) if y not in a] #兩個列表中的不同元素print(a的值為:,a) print(b的值為:,b)c [x for x …

springcloud(六):配置中心git示例

隨著線上項目變的日益龐大&#xff0c;每個項目都散落著各種配置文件&#xff0c;如果采用分布式的開發模式&#xff0c;需要的配置文件隨著服務增加而不斷增多。某一個基礎服務信息變更&#xff0c;都會引起一系列的更新和重啟&#xff0c;運維苦不堪言也容易出錯。配置中心便…

寫作工具_4種加快數據科學寫作速度的工具

寫作工具I’ve been writing about data science on Medium for just over two years. Writing, in particular, technical writing can be time-consuming. Not only do you need to come up with an idea, write well, edit your articles for accuracy and flow, and proofr…

leetcode 91. 解碼方法(dp)

解題思路 記憶化搜索&#xff0c;記錄已經計算過的子問題 代碼 func numDecodings(s string) int {temp:make([]int,len(s),len(s))for i : range temp {temp[i]-1}return de(s,0,temp) } func de(s string,cur int,dp []int) int {if curlen(s){return 1}if dp[cur]!-1{re…

python數據結構與算法

2019獨角獸企業重金招聘Python工程師標準>>> http://python.jobbole.com/tag/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B8%8E%E7%AE%97%E6%B3%95/ 轉載于:https://my.oschina.net/u/3572879/blog/1611369

test5

test5 轉載于:https://www.cnblogs.com/Forever77/p/11468284.html