html练习(3)
1.这个小练习用到了css的四种选择器id选择器,类选择器,html选择器,通配符选择器。
(1)假设一个元素中用到了各种选择器,而且选择器中的属性发生了冲突,则
优先级为id选择器>类选择器>html选择器>通配符选择器。
(2)假设一个元素中用到了同一种选择器的不相同式,若发生了属性冲突,则以在css文件里后一个定义的属性值为准。
2..用到了未訪问的链接,鼠标悬浮的状态,以及已訪问的链接的状态。
html文件(test3.html):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>一叶扁舟</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="./test3.css">
<style type="text/css">
/*控制图片的大小*/
img {
filter: "black";
border: 0;
margin: 0;
padding: 0;
max-width: 180px;
width: expression(this.width > 150 ? "150px" : this.width);
max-height: 180px;
height: expression(this.height > 150 ? "150px" : this.height);
}
/*使用滤镜,网页的图片变为灰色*/
a:link {
filter: "gray";
text-decoration: none;
}
/*已訪问*/
a:visited {
color: red;
}
/*鼠标悬浮时,图片变回原来的颜色*/
a:hover {
filter: "";
color: pink;
text-decoration: underline;
}
</style>
</head>
<body>
<h1>
<font color="blue"> 採用了<span class="s1 s2"><span
id="style1">滤</span>镜</span>效果和鼠标的<span class="s3 s4">悬浮</span>效果</font>
</h1>
<br>
<span class="s1"><a href="#">链接到淘宝</a>淘啊淘!</span>
<br />
<a href="#">进入百度收索</a>
<br />
<a href="#">进入搜狐站点</a>
<br />
<a href="#"><img src="./image/a.jpg" /> 这是一张图片</a>
<br />
<a href="#"><img src="./image/b.jpg" />
</a>
<a href="#"><img src="./image/c.jpg" />
</a>
<a href="3"><img src="./image/d.jpg" / width="180px"
height="180px">
</a>
</body>
</html>
css文件(test3.css):
/*id选择器*/
#style1 {
font-size: 90px;
font-style: normal;
background-color: yellow;
}
/*这些都是类选择器*/
.s1 {
color: blue;
font-size: 50px;
}
.s2 {
background-color: black;
font-style: italic;
font-size: 80px;
color: red;
font-weight: bold;
}
.s3 {
background-color: gray;
font-weight: bolder;
}
.s4 {
background-color: green;
font-style: italic;
font-weight: bold;
font-size: 80px;
text-decoration: underline;
}
/*html选择器*/
body {
background-color: yellow;
}
div {
font-size: 40px;
}
/*通配符选择器--全部的元素都符合某一种样式*/
* {
margin: 0;
padding: 0;
}
效果图片:
最新文章
- 不可或缺 Windows Native 系列文章索引
- RestEasy 3.x 系列之一:Hello world
- c trans
- Ansible安装配置Nginx
- DDL、DML、
- Dos下查询关闭端口的命令例子
- 《WPF程序设计指南》读书笔记——第3章 内容的概念
- hadoop面试时可能遇到的问题
- spark actions 算子
- pc端网页,移动端网页(andorid、ios)离开页面做一个时间存储
- 04-Python入门学习-流程控制
- mysql 开发进阶篇系列 19 MySQL Server(innodb_flush_log_at_trx_commit与sync_binlog)
- 在CentOS 7中安装与配置Tomcat-8.5方法
- 微信小程序实现部分双向数据绑定(为input、picker、textarea编写统一的更新数据逻辑)
- 【2019北京集训六】路径(path) 二分+DP
- TensorFlow:tf.nn.max_pool实现池化操作
- bin/hdfs dfs命令存在WARN util.NativeCodeLoader问题消除方法
- js中定时器
- ng-include 上ng-controller 无法获取控件
- EF4.4 升级EF6.0问题总结
热门文章
- 【LeetCode-面试算法经典-Java实现】【008-String to Integer (atoi) (字符串转成整数)】
- 在OEL 5.4 32bit上使用yum install命令遇到的问题
- 强悍的 vim —— 删除空行、删除注释以及加注释解注释
- C#制作文本转换为声音的demo,保存音频文件到本地
- 1.实用:Google Chrome 键盘快捷键大全
- 荣获CCF(中国计算机学会)高级会员代表资格
- CString与 char *之间的转换
- 跟我一起造轮子 手写springmvc
- FreeModbus TCP
- wordpress+wampserver