CSS的常见样式

1.文字的样式

样例:

p{
    /* 文字对齐方式 */
    /* text-align: center; */

    /* 设置大小 单位 pt pc px in cm mn*/
    font-size:50px;
    /* 设置字体:宋体 楷体 隶书 */
    font-family: "宋体";
    /* 设置字体样式:italic斜体 normal正常 */
    font-style: italic;
    /*颜色: */
    color: blue;
    /* 文字的粗细 */
    font-weight: 800;
    /* 文字的特殊效果 underline overline line-through */
    text-decoration: line-through;
    /* 文字首行缩进的百分比 */
    text-indent: 2%;
}

效果:

2.图片的样式 

img{
    /* 图片的线框的线性 dashed dotted solid */
    border-style: solid;

    /* 边框的颜色 */
    border-color:aqua;

    /* 边框的粗细 */
    border-width: 20px;

    /* 将线型 颜色 粗细合并为一个语句 */
    /* 例如:border:solid aqua 20px; */

    /* 水平对齐方式 */
    text-align: center;

    /* 文字垂直对齐方式 bottom super sub middile*/
    vertical-align: bottom;

    /* 图片环绕文字的方式 left right */
    float: left;

    /* 图片与文字之间的距离 */
    margin: 40px;

    /* 图片的宽度 */
    width: 200px;

    /* 图片的高度 */
    height: 400px;
}

3.设置背景颜色

.p1{
    /* 设置背景颜色 */
    background-color: black;
    
    /* 设置背景图片是否可以重复出现,可以取值为
    repeat-x repeat-y  no-repeat repeat
    */
    background-repeat: repeat-x;

    /* 设置背景图片的位置 */
    background-position: right;

    /* 设置背景图片是否固定 默认fiexd表示被固定了 */
    background-attachment: fixed;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值