zoukankan      html  css  js  c++  java
  • CSS学习(4)常见样式声明

    1.文本

    color 文字颜色

    预设值:定义好的单词,如red blue

        光学的三原色(红,绿,蓝),如 rgb(32,45,255)

        HEX十六进制,如#008CFF(#112233可以简写为#123)

    text-align 对齐方式

    值:center居中  right居右  justify每一行被展开为宽度相等,左,右外边距是对齐(如杂志和报纸)。

    text-decoration 文本修饰

    值:none 无,主要用来去掉链接下划线   overline 这种效果   line-through 这种效果   underline 这种效果

    text-transform 文本转换

    值:uppercase 大写字母   lowercase 小写字母   capitalize 首字母大写

    text-indent 文本首行缩进

    2.背景

       background-color 元素背景颜色

       background-image 背景图像  body {background-image:url('paper.gif');}

       background-repeat 水平或垂直平铺  background-repeat:repeat-x;

       background-position 设置定位 background-position:right top;

       background-attachment 设置背景图像是否固定(不随滚轮上下滑动)background-attachment:fixed;

       简写:

       body {background:#ffffff url('img_tree.png') no-repeat right top;}

    3.字体(必须用户电脑中有安装设置的字体才有效)

    (打印出来的用serif好看一些)

    font-family:宋体,Georgia,serif;   可以设置多个字体以防止用户浏览器不识别

    font-size 文字尺寸

    px:像素,绝对单位

    em:相对单位,相对于父元素的大小,如2em就是2倍于父元素字体大小,如果父元素没有字体大小则以浏览器基准字号为准。

    font-weight 文字粗细程度

    值:bold 加粗 相当于700,也可以自定义数字大小

    font-style 字体样式

    值:normal 正常的   italic 斜体

    简写:font:italic bold 12px/30px Georgia,serif;

    4.link 链接样式

    a:link {color:#000000;} /* 未访问链接*/
    a:visited {color:#00FF00;} /* 已访问链接 */
    a:hover {color:#FF00FF;} /* 鼠标移动到链接上 */
    a:active {color:#0000FF;} /* 鼠标点击时 */
  • 相关阅读:
    0309. Best Time to Buy and Sell Stock with Cooldown (M)
    0621. Task Scheduler (M)
    0106. Construct Binary Tree from Inorder and Postorder Traversal (M)
    0258. Add Digits (E)
    0154. Find Minimum in Rotated Sorted Array II (H)
    0797. All Paths From Source to Target (M)
    0260. Single Number III (M)
    0072. Edit Distance (H)
    0103. Binary Tree Zigzag Level Order Traversal (M)
    0312. Burst Balloons (H)
  • 原文地址:https://www.cnblogs.com/1016391912pm/p/11538319.html
Copyright © 2011-2022 走看看