<!-- <a href="https://www.tmall.com">天猫</a>
<style>
a:link{link:未曾访问的链接
background: red; 显示红色
}
a:visited{visited:访问过的链接
background: green; 显示绿色
}
a:hover{ 鼠标悬浮
background: white; 显示白色
text-decoration: underline; 并带有下划线
}
a:active{ 鼠标点击不放
background: yellow; 显示黄色
}
</style>-->
效果如下(因为曾访问过,所以红色不显示了)
<div>郑州大学</div>
<style>
div{
border: 1px solid red;
height: 200px;
text-align: center;
line-height: 200px;
/*
font-style: italic;
font-weight: 900;
font-size: 120px;
font-family: "微软雅黑";*/ 对字体样式的设置顺序不可颠倒
以上四行字体设置代码可以简化成下面这一行,但是顺序不可变化
font: italic bold 120px/200px "微软雅黑";简化后 line-height无效,需要在字体大小后加上/200px才可生效
}
</style>
效果如下:
利用background-position来截取图片:
<i></i>
<style>
i{
height: 20px; 设置截取高度
width: 20px; 设置截取高度
border:1px solid red; 设置边框颜色
display: inline-block; 使其变为行内块级元素
background-image: url(img/images.png); 插入待截取图片
background-repeat: no-repeat; 设置图片显示不重复
background-position:-135px -70px; 设置截图初始位置
与字体样式设置不同,背景设置没有顺序
}
</style>
例如将图片:中的紫色钻石截取出来。
效果为