html

css规则:

网页结构数据应该写在html文件中;

网页的表现形式应写在css文件中;

网页的行为应写在js文件中;

将网页的数据行为表现分离,方便代码的维护。



引用css文件

<link rel="stylesheet" type="text/css" href="css/Style.css"/>

css选择器(按优先级排列)

id选择器

类选择器

标签选择器


样式表的优先级:

行内样式>内嵌样式>外部样式

样式的优先级:

默认样式:浏览器默认的央视<外部样式:样式写在一个css文件中<内部样式:写在html文件中<内联样式:写在标记里


使用全局选择器,可以对所有html标签设置相同样式。

在html标签行内添加css样式时,可以使用style属性

外部样式有链接式和导入式两种


盒子模型

边框border

内边距padding

外边距margin

盒子模型尺寸:border-width+padding+margin+内容尺寸(宽度,高度)


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>创建按钮式超链接</title>
<style type="text/css">
body{
margin:20px;
}
a{
font-family:Arial;
margin:5px;
}
a:LINK,a:VISITED{
color:#CF0;
padding:4px 10px 4px 10px;
background-color:#06C;
text-decoration:none;
border-top:1px solid #EEEEEE;
border-left:1px solid #EEEEEE;
border-bottom:1px solid #066;
border-right:1px solid #960;
}
a:HOVER{
color:#0C6;
padding: 5px 8px 3px 12px;
background-color:#933;
border-top:1px solid #93F;
border-left:1px solid #F30;
border-bottom:1px solid #3C3;
border-right:1px solid #3FF;
}
</style>
</head>


<body>
<a href="http://www.bing.com"/>a
    <a href="http://www.bing.com"/>b
    <a href="http://www.bing.com"/>c
    
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值