html总结(2)

1 定义字体不必每次都在<p></p>内写可以用css

<head><style type="text/css">body {background-color: red}p {margin-left: 20px}</style></head>统一样式

或者

<p style="color: red; margin-left: 20px">This is a paragraph</p>

或者外链

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

 

2当鼠标指针悬停于某元素之上时执行脚本

onmouseover

 

3css

下面的示意图为您展示了上面这段代码的结构:

CSS 语法

提示:请使用花括号来包围声明。

 

4 定义了常态,通过继承可以定义特殊化的样式

strong {
     color: red;
     }

h2 {
     color: red;
     }

h2 strong {
     color: blue;
     }

下面是它施加影响的 HTML:

 

<p>The strongly emphasized word in this paragraph is<strong>red</strong>.</p>
<h2>This subhead is also red.</h2>
<h2>The strongly emphasized word in this subhead is<strong>blue</strong>.</h2>

 

5定义新的选择器newID,使用为:

#newID{color:red;}

 

<p id="newID">这个段落是红色。</p>

 

6定义新的类选择器newClass,使用为

类选择器以一个点号显示:

.center {text-align: center}

 

<h1 class="center">This heading will be center-aligned</h1><p class="center">This paragraph will also be center-aligned.</p>

 

7属性样式

下面的例子为带有 title 属性的所有元素设置样式:

[title]
{
color:red;
}

 

 

input[type="text"]{ width:150px; display:block; margin-bottom:10px; background-color:yellow; font-family: Verdana, Arial;}input[type="button"]{ width:120px; margin-left:35px; display:block; font-family: Verdana, Arial;}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值