Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537
TML標簽:
所有內容都在<html></html>標簽之內;
<head></head>內放的是頭部信息,是對頁面的描述,不會直接顯示在頁面中。
<head></head>內的<title></title>中設置的是頁面的標題,<title></title>只能放在<head></head>中;
<body></body>是頁面的主體,大部分顯示內容都定義在這里。
HTML注釋:<!-- -->:
注釋不允許嵌套
html常用標簽:
h標簽(標題),HTML定義了<h1></h1>到<h6></h6>六個h標簽,分別表示不同大小的字體。h1最大,h6最小。
<br/>只是回車,<p>是段落。<p>前后會有比較大的空白,而<br/>則沒有。
<center>居中顯示.
<b>、<strong>粗體,<i>、<em>斜體。<u>下劃線。
<sub>2</sub>下標,如:H<sub>2</sub>O
<sup>2</sup>上標,如:10<sup>2</sup>
<font></font>字體標簽,<font color=“red“ size=“7” face=“隸書”>紅色</font>。color(設置顏色) size(1-7) face(設置字體,設置字體是注意用戶計算機中必須有該字體才能正常顯示)
<hr> color size(厚度) width(長度) align=left/center/right (默認為劇中顯示)
<pre> 預格式化 保持本色;
HTML特殊字符:<(小于號,less than);>(大于號,greater than); (空格)。
超鏈接:<a>標簽的一些常用屬性:href、title、target、name
插入圖片:<img src=“路徑”/>
列表:dl→(定義列表),ul→(無序列表), ol→(有序列表)。
表格:<table>;創建行:<tr>;創建單元格:<td>;表頁眉:<thead>;表主體:<tbody>;表頁腳:<tfoot>;表頭:<th>。
rowspan(合并行)、colspan(合并列)
<input>是主要的表單元素,type的可選值:submit(提交按鈕)、button(普通按鈕)、checkbox表單標簽:(復選框)、file(文件選擇框)、hidden(隱藏字段)、image(圖片按鈕)、password(密碼框)、radio(單選按鈕)、reset(重置按鈕)、text(文本框)。
meta標簽:(包括在head標簽中。主要用來描述頁面自身信息,元信息)
<meta name="keywords" content="C#學習資料,4k8k.net,.net開發,軟件開發,編程自學網"/>
<meta name="description" content="免費更新最新C#相關技術知識,主要包括:.net基礎,網頁前端,三層架構,SQL數據庫..."/>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />網頁編碼
<meta http-equiv="Refresh" content="3" />三秒鐘后刷新此網頁。
<meta http-equiv="Refresh" content="3;url=http://www.4k8k.net" />三秒鐘后重定向到新網頁。
<meta http-equiv="Cache-Control" content="no-cache" /> 禁止瀏覽器緩存頁面。
<meta name="名字" content="值" />關于網頁的描述信息。
<meta http-equiv="名字" content="值" />模擬http響應頭信息。
C#編程自學_做最好的.net自學資料站_更多文章請訪問:http://www.4k8k.net/
歡迎訂閱。
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特性,以保持我們技能的前沿性。
格是頁面中常見的一中標簽,通常是用來數據展示的,而不是用來布局。
<table>
<tr>
<td>單元格內的文字</td>
...
</tr>
...
</table>
設置表格的外觀樣式
<table border=1>
<tr>
<th>姓名</th>
<th>性別</th>
<th>電話</th>
</tr>
<tr>
<th>張三</th>
<td>女</td>
<td>18611110000</td>
</tr>
<tr>
<th>李四</th>
<td>男</td>
<td>18711110000</td>
</tr>
<tr>
<th>王五</th>
<td>男</td>
<td>18811110000</td>
</tr>
</table>
表格標題標簽,為表格添加標題,跟隨表格的位置而移動。設置標題,我們用的是caption標簽。
<table border="1">
<caption style="text-align:left">My savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>0</td>
</tr>
</table>
將標題定位在表格的左|右|上|下位置。
跨行合并 rowspan=“合并單元格的個數”
跨列合并 colspan=“合并單元格的個數”
合并順序:先上后下,先左后右
...
姓名 | 張三 | 性別 | 李四 | 照片 |
家庭住址 | 張三 | 性別 | 李四 | 照片 |
```
(1)先確定是跨行還是跨列合并
(2)根據先上后下,先左后右的原則,找到目標單元格,寫上合并方式(rowspan/colspan)和要合并的單元格數量
(3)刪除多余的單元格
表格的結構劃分,使用thead、tbody 、tfoot 三種標簽
<table border="1">
<thead>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Sum</td>
<td>0</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>January</td>
<td>0</td>
</tr>
<tr>
<td>February</td>
<td></td>
</tr>
</tbody>
</table>
(1) 元素內部必須包含一個或者多個 標簽。
(2) thead, tbody, 和 tfoot 元素默認不會影響表格的布局。用途主要是可以使用 CSS 來為這些元素定義樣式,從而改變表格的外觀。
*請認真填寫需求信息,我們會在24小時內與您取得聯系。