這篇文章主要介紹了html中插入CSS的方法,具有一定借鑒價值,需要的朋友可以參考下。希望大家閱讀完這篇文章后大有收獲。下面讓小編帶著大家一起了解一下。
1.注釋:
(1).HTML的注釋:
(2).CSS的注釋:/* *
2.HTML中插入CSS(層疊樣式表)的方法
(1).行內樣式 (在標簽后面直接寫樣式)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>行內樣式</title>
</head>
<body>
<p style="font-famliy:宋體; text-align:center;font-style:italic; text-transform:uppercase; font-size:22px; text-decoration:underline; font-weight:bold; letter-spacing:13px">html中插入css樣式的方法:</br>1 行內樣式;2 內部樣式; <br/>3 外部樣式; 4 導入樣式;</p>
</body>
</html>(2)嵌入式(將樣式和html語言分開寫)
<!doctype html><html><head>
<meta charset="utf-8">
<title>行內樣式</title>
<style type="text/css">
p{ text-decoration:underline; text-align:center; font-size:26px; font-family:宋體; font-weight:bolder; text-transform:lowercase; letter-spacing:4px; color:pink; background-color:green; }
</style></head><body>
<p >HTML中插入CSS樣式的方法:</br>
1 行內樣式;2 內部樣式; <br/>
3 外部樣式; 4 導入樣式; </p></body></html>3.外部樣式(鏈接式:將CSS和HTML分開寫)?。。?!最常用
first.html
<!doctype html><html><head>
<meta charset="utf-8">
<title>行內樣式</title>
<link href="first.css" type="text/css" rel="stylesheet"></head><body>
<p >HTML中插入CSS樣式的方法:</br>
1 行內樣式;2 內部樣式; <br/>
3 外部樣式; 4 導入樣式; </p></body></html>first.css
p{ text-decoration:underline;/*加下劃線*/
text-transform:lowercase;/*大寫字母全部小寫*/
text-align:center;/*居中*/
font-size:23px;/*字體大小*/
font-family:黑體;/*設置字體*/
font-style:italic;/*設置字傾斜*/
text-indent:3px;/*設置首行縮進*/
color:red;/*設置字體顏色*/
background-color:#ddd;/*設置背景顏色*/
letter-spacing:4px;}4.導入式
first.html
<!doctype html><html><head>
<meta charset="utf-8">
<title>行內樣式</title>
<style type="text/css">
@import url(first.css); </style></head><body>
<p >HTML中插入CSS樣式的方法:</br>
1 行內樣式;2 內部樣式; <br/>
3 外部樣式; 4 導入樣式; </p></body></html>first.css
p{ text-decoration:underline;/*加下劃線*/
text-transform:lowercase;/*大寫字母全部小寫*/
text-align:center;/*居中*/
font-size:33px;/*字體大小*/
font-family:黑體;/*設置字體*/
font-style:italic;/*設置字傾斜*/
text-indent:3px;/*設置首行縮進*/
color:red;/*設置字體顏色*/
background-color:#ddd;/*設置背景顏色*/
letter-spacing:4px;}感謝你能夠認真閱讀完這篇文章,希望小編分享html中插入CSS的方法內容對大家有幫助,同時也希望大家多多支持億速云,關注億速云行業資訊頻道,遇到問題就找億速云,詳細的解決方法等著你來學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。