简单CSS样式表的写法

html-css010

简单CSS样式表的写法,第1张

<html>

<head>

<style type="text/css">

a.top:link {font-family: 宋体} /*链接字体*/

a.top:link {font-weight: normal} /*设置链接文字中的字符粗细*/

a.top:link {font-size: 12} /*设置链接文字的大小*/

a.top:link {text-decoration: none} /*设置链接文字没有下划线*/

a.top:hover {text-decoration: underline} /*鼠标放在链接上时有下划线*/

a.top:link {color: #000000} /*设置链接文字的颜色*/

a.top:visited {color: #000000} /*访问过的链接*/

a.top:hover {color: #B50000} /*鼠标放在链接上字体的颜色*/

a.tj:link {font-family: 宋体}

a.tj:link {font-weight: normal}

a.tj:link {font-size: 12}

a.tj:link {text-decoration: none}

a.tj:hover {text-decoration: none}

a.tj:link {color: #000000}

a.tj:visited {color: #0000ff}

a.tj:hover {background: #FFFFCC}

h1 {font-size:12px} 

h1 {font-family: "宋体"} 

h1 {font-weight: normal}

h1 {color: #000000}

h2 {font-size:14px} 

h2 {font-family: "宋体"} 

h2 {font-weight: normal}

h2 {color: #000000}

h3 {font-size:24px} 

h3 {font-weight: 1}

h3 {color: #000000}

body {

        margin-top: 1px /*上边距*/

        margin-bottom: 1px /*下边距*/

}

</style>

<meta http-equiv="Content-Type" content="text/html charset=gb2312"></head>

<body>

<p>Mouse over the links to see them change layout.</p>

<p><b><a href="default.asp" target="_blank" class="top">电脑对怀孕其实没啥影响</a></b></p>

<p><b><a href="default.asp" target="_blank" class="tj">电脑对怀孕其实没啥影响</a></b></p>

<h1>电脑对怀孕其实没啥影响</h1>

<h2>电脑对怀孕其实没啥影响</h2>

<h3>电脑对怀孕其实没啥影响</h3>

</body>

</html>

关于CSS的特效,大部分都是使用了hover事件,或者你再完成一些特殊要求的时候,你会使用mouseenter和mouseleave来代替hover,我就遇到过一种就是鼠标移开时,悬浮显示的元素依然占了文档流,而且你不能使用display:none来隐藏他,这样的话,过渡效果会受到影响!

最简单的hover写法,淡入淡出,关键在于pointer-events的使用,保证淡入淡出都有过渡效果的同时,子元素不会被父元素hover事件所影响!