例
<article> 的頁眉:
<article>
<header>
<h1>Internet Explorer 9</h1>
<p><time pubdate datetime="2011-03-15"></time></p>
</header>
<p> Windows Internet Explorer 9(縮寫為 IE9 )是在2011年3月14日21:00發布的</p>
</article>
瀏覽器支持
IE 9、Firefox、Opera、Chrome 和 Safari 支持 <header> 標簽。
注釋:IE 8 或更早版本的 IE 瀏覽器不支持 <header> 標簽。
標簽定義及使用說明
<header> 標簽定義文檔或者文檔的一部分區域的頁眉。
<header> 元素應該作為介紹內容或者導航鏈接欄的容器。
在一個文檔中,您可以定義多個 <header> 元素。
注釋:<header> 標簽不能被放在 <footer>、<address> 或者另一個 <header> 元素內部。
HTML 4.01 與 HTML5之間的差異
<header> 標簽是 HTML 5 中的新標簽。
全局屬性
<header> 標簽支持 HTML 的全局屬性。
事件屬性
<header> 標簽支持 HTML 的事件屬性。
如您還有不明白的可以在下面與我留言或是與我探討QQ群308855039,我們一起飛!
頁面設計將全部的structure功能都集中于之中。
html結構圖-01
html結構圖與word文檔做平行的對比。
html結構圖-02
Murach的總結比其他的教材更為出色。
HTML負責結構,CSS負責裝飾,用html的strucure思路重新思考word的排版。
SS中的浮動(Floats)、定位(Positioning)和顯示(Display)屬性是前端工程師掌握頁面布局的關鍵。本文將深入探討這些屬性的工作原理和使用場景,幫助開發者更好地理解和運用它們來構建響應式和精確的網頁布局。
浮動是CSS中用于實現元素排列的一種方式,它可以讓元素脫離正常的文檔流,并可以向左或向右移動,直到它的外邊緣碰到包含框或另一個浮動元素的邊緣。
.element {
float: left; /* 或者 'right' */
}
.clear-element {
clear: both; /* 可以是 'left', 'right', 或 'both' */
}
定位屬性允許你控制元素的位置,它可以是相對于它的正常位置、相對于最近的已定位祖先元素、相對于視口或絕對位置。
.element {
position: static | relative | absolute | fixed | sticky;
}
.relative-element {
position: relative;
top: 10px;
left: 20px;
}
.absolute-element {
position: absolute;
top: 0;
right: 0;
}
.fixed-element {
position: fixed;
bottom: 0;
left: 0;
}
.sticky-element {
position: sticky;
top: 10px;
}
display屬性是CSS中最重要的用于控制布局的屬性之一,它定義了元素如何顯示在頁面上。
.element {
display: block | inline | inline-block | flex | grid | none;
}
.block-element {
display: block;
}
.inline-element {
display: inline;
}
.inline-block-element {
display: inline-block;
}
.flex-container {
display: flex;
}
.grid-container {
display: grid;
}
.hidden-element {
display: none;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Float, Position, and Display Example</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="header">
<div class="logo">Logo</div>
<div class="navigation">Navigation</div>
</div>
<div class="main-content">
<div class="sidebar">Sidebar</div>
<div class="content">Content</div>
</div>
<div class="footer">Footer</div>
<div class="fixed-element">Fixed Element</div>
</body>
</html>
/* Reset some default styles */
body, h1, p {
margin: 0;
padding: 0;
}
/* Header styles */
.header {
background-color: #f8f8f8;
border-bottom: 1px solid #e7e7e7;
padding: 10px;
overflow: hidden; /* Clearfix for floated elements */
}
.logo {
float: left;
font-size: 24px;
}
.navigation {
float: right;
font-size: 18px;
}
/* Main content styles */
.main-content {
padding: 20px;
}
.sidebar {
float: left;
width: 200px;
background-color: #ddd;
padding: 10px;
}
.content {
margin-left: 220px; /* Make space for the sidebar */
background-color: #eee;
padding: 10px;
}
/* Footer styles */
.footer {
background-color: #f8f8f8;
border-top: 1px solid #e7e7e7;
text-align: center;
padding: 10px;
position: relative; /* For demonstration purposes */
top: 20px; /* Move the footer down a bit */
}
/* Fixed element styles */
.fixed-element {
position: fixed;
bottom: 10px;
right: 10px;
padding: 5px 10px;
background-color: #333;
color: #fff;
z-index: 1000; /* Ensure it stays on top */
}
/* Clearfix hack */
.clearfix::after {
content: "";
clear: both;
display: table;
}
在這個例子中,我們創建了一個包含頭部、側邊欄、主要內容和頁腳的基本布局。我們使用浮動來對齊頭部的Logo和導航,以及創建一個側邊欄。我們還使用了相對定位來稍微下移頁腳,并使用固定定位為頁面添加了一個始終可見的固定元素。最后,我們使用了overflow: hidden;來清除頭部中浮動元素的影響。
浮動、定位和顯示屬性是CSS中構建復雜布局的強大工具。通過深入理解和正確應用這些屬性,前端工程師可以創建出既美觀又功能強大的網頁。隨著Web標準的不斷發展,我們也需要不斷學習和適應新的CSS特性,以保持我們技能的前沿性。
*請認真填寫需求信息,我們會在24小時內與您取得聯系。