CSS与HTML的学习
CSS:层叠样式表:
美化HTML页面效果。
将HTML中的标签用CSS中的属性进行再次处理。
CSS与HTML的结合方式:
直接在某个标签中,通过Style属性来设置样式。
格式:<font color = "red" size = "24px">示例</font>
<font style = "color:red; font-size:24px">示例</font>
直接在某个标签中,通过class属性来关联一个CSS样式:
格式:<style type="text/css">
.haha{
text-align: left; line-height: 1.75; font-size: 14px;"> }
</style>
<font class="haha">演示</font>
<head></head>之间 使用<style></style>进行css样式的设置
<head>
<style type="text/css">
font{
text-align: left; line-height: 1.75; font-size: 14px;"> }
</style>
</head>
<font>演示</font>
<style type="text/css">
@import url("div.css")
</style>
<head></head>之间 使用<link></link>进行css样式的设置
<link rel="stylesheet" href="div.css" type="text/css">
CSS三种选择器使用方式:
格式:<div id="haha" class="haha">你好</div>
HTML标签名
div{
color:red
}
CLASS方式
.haha{
color:red
}
ID方式
#haha{
color:red
}
CSS的扩展选择器:
关联选择器:table tr td {
background-color = "red"
}
组合选择器:table, p, div {
background-color = "red"
}