1. 用id连接到元素
<a href = "index.html#chai">用id连接到元素</a>
2. target属性(是否在新窗口打开链接)
<a href="pref.html" target="view_window">Preface</a>
3. 格式
<!doctype html>
<html>
<head>
<meta charset = "utf-8">
</head>
<body></body>
</html>
4. html引入css
<style>
<!-- 此处写css代码 -->
</style>
<link type = "text/css" rel = "stylesheet" href = "../xx/xx.css"/>
5. 引用外部字体并使用
@font-face {
font-family:"Emblema One";
src : url("http://xxxx.woff"),uil("http://xxxx.ttf");
}
body {
font-family:"Emblema One"
}
6. 设备适配(media 绑定启用此样式表的设备类型)
1. link中指定
// 手机
<link type = "text/css" rel = "stylesheet" href = "../xx/mobile.css"
media = "screen and (max-device-width: 480px)"/>
// 打印机
<link type = "text/css" rel = "stylesheet" href = "../xx/print.css"
media = "print"/>
2. css中指定
// 只用于打印机的css
@media print {
body {
font-family:"Emblema One";
}
}
// 所有
body {
font-family:"Emblema One";
}
7. css引用外部css
<link rel = "stylesheet" href = "xxx.css" type = "text/css" media = screen>