zoukankan      html  css  js  c++  java
  • css常用样式

    font-family 设置字体名称

    可以使用多个名称,用逗号分隔,浏览器则按照先后顺序依次使用可用字体

    p { font-family:'宋体','黑体','Arial'; }

    font-size 设置字体大小

    length 用长度值指定文字大小,不允许负值

    percentage 用百分比指定文字大小,其百分比取值是基于父对象中字体的尺寸,不允许负值

    p { font-size:14px;}

    font-weight 控制字体粗细

    normal 正常的字体,相当于数字值400

    bold 粗体,相当于数字值700

    100~900 定义由细到粗的字符

    p { font-weight:bold;}

    font-style 控制字体是否倾斜

    normal 指定文本字体样式为正常的字体

    italic 指定文本字体样式为斜体,对于没有设计斜体的特殊字体,如果要使用斜体外观将应用oblique

    oblique 指定文本字体样式为倾斜的字体,人为的使文字倾斜,而不是去选取字体中的斜体字

    p { font-style: normal; }
    p { font-style: italic; }
    p { font-style: oblique; }

    font(字体样式缩写)

    复制代码
    例:
    p{
    font-style: italic;
    font-weight: bold;
    font-size: 14px;
    line-height: 22px;
    font-family:'宋体';
    }
    
    缩写后:
    p { font: italic bold 14px/22px '宋体'; }
    复制代码

    color 文本颜色

    • 英文单词,比如:red,yellow,green …
    • 十六进制表示方式,#开头,6个十六进制的字符或数字组合,比如:#FFFFFF,#000000 …
    • RGB模式,红 0-255,绿 0-255,蓝 0-255,比如:RGB(120,33,234)
    • RGBA模式,比如:RGBA(255,0,0,0.5),最后的A表示透明度50%

    text-decoration 文本装饰线条

    none 默认。定义标准的文本

    underline 定义文本下的一条线

    overline 定义文本上的一条线

    line-through 定义穿过文本的一条线

    blink 定义闪烁的文本

    h1 {text-decoration:overline;}
    h2 {text-decoration:line-through;}
    h3 {text-decoration:underline;}

    text-shadow 文本阴影

    h-shadow 必需。水平阴影的位置。允许负值

    v-shadow 必需。垂直阴影的位置。允许负值

    blur 可选。模糊的距离

    color 可选。阴影的颜色

    h1{ text-shadow: 2px 2px 2px #ff0000;}

    宽度 width : auto | length

    高度 height : auto | length

    p { 300px;}
    div { 50%;}
    img { height:200px;}
    div { height:100px;}

    外边距 margin : auto | length

    margin-top 设置上边的外边距

    margin-bottom 设置下边的外边距

    margin-left 设置左边的外边距

    margin-right 设置右边的外边距

    缩写型式:

    margin: 上边距  右边距  下边距  左边距

    margin: 上下边距  左右边距

    margin: 上边距  左右边距  下边距

    div { 300px; height:100px; margin:10px;}
    div { 300px; height:100px; margin:0 auto;}

    内边距 padding : length

    padding-top 设置上边的内边距

    padding-bottom 设置下边的内边距

    padding-left 设置左边的内边距

    padding-right 设置右边的内边距

    div { 300px; height:100px; padding:10px;}

    透明度 opacity : <number>

    number值为 0.0-1.0 之间的小数

    兼容全浏览器的写法:

    div{ filter:alpha(opacity=50); }  /* IE6-IE8 */
    div{ opacity:0.5; }  /* 现代浏览器 */
  • 相关阅读:
    CSLA服务端如何使用多线程的解决方案
    一片马蜂窝文章
    VB.NET和C#之间的语法不同比较
    [软件推荐]jQuery,JavaScript,HTML,CSS,PHP,MySQL,正则表达式 CHM帮助手册
    使用jQuery.Validate进行客户端验证
    知道AutoHotKey
    数据库设计问题
    [书籍推荐]为了自己的钱包,为了自己的时间——分享一下自己的淘书经验
    策略模式4
    SQLiteHelperSQLite帮助类
  • 原文地址:https://www.cnblogs.com/q1345837355/p/5762240.html
Copyright © 2011-2022 走看看