1. 常用的css样式

87 阅读1分钟
样式解释
background-color设置背景颜色
color设置字体颜色
text-align设置文本对齐方向,left/center/right
height设置元素的高度
line-height设置行高
text-decoration设置文本修饰
border-width边框的宽度
border-style边框的样式
border-color边框的颜色
p:hover{color:blue}当鼠标移动到元素上时可以改变元素的css样式

a标签的文本修饰

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        a{
            /* 链接没有下划线 */
            text-decoration: none;
        }
    </style>
</head>
<body>
    <a href="#">webgis</a>
</body>
</html>

鼠标悬停样式

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* p:hover  鼠标悬停在p标签上面,样式发生改变 */
        p:hover{
            /* 字体颜色 */
            color: crimson;
            /* 抓手 */
            cursor: pointer;
            /* 背景颜色 */
            background-color: cornsilk;
            /* text-decoration文本修饰 */
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <p>
        hello word
    </p>
</body>
</html>