CSS-03表格样式、图片样式、背景样式

    科技2026-03-29  14

    一.表格样式

    1.表格标题位置(caption-side)

    caption-side:取值; caption-side属性取值 属性值说明top标题在顶部(默认值)bottom标题在底部

    2.表格边框合并(border-collapse)

    border-collapse:取值; border-collapse属性取值 属性值说明separate边框分开,有空隙(默认值)collapse边框合并,无空隙

    3.表格边框间距(border-spacing)

    border-spacing:像素值;

    二.图片样式

    1.图片大小

    width:像素值;

    height:像素值;

    2.图片边框

    border:1px solid red;

    3.图片对齐

    水平对齐:

    text-align:取值;

    取值:left(左对齐)、center(居中对齐)、right(右对齐)

    垂直对齐:

    vertical-align:取值;

    取值:top(顶部对齐)、middle(中部对齐)、baseline(基线对齐)、bottom(底部对齐)

    4.文字环绕-初始float

    float:取值;

    取值:left(元素向左浮动)、right(元素向右浮动)

    三.背景样式

    1.背景颜色(background-color)

    background-color:颜色值;

    颜色值:1.关键字   2.16进制RGB

    2.背景图片样式(background-image)

    background-image:url(图片路径);

    3.背景图片重复(background-repeat)

    background-repeat:取值; background-repeat属性取值 属性值说明repeat在水平方向和垂直方向上同时平铺repeat-x只在水平方向上平铺repeat-y只在垂直方向上平铺no-repeat不平铺

    4.背景图片位置(background-position)

    background-position:像素值/关键字;

    4.1像素值:background-position:水平距离 垂直距离;

    4.2关键字:background-position:水平距离 垂直距离;

    background-position关键字取值 属性值说明top left左上top center靠上居中top right右上left center靠左居中center center正中right center靠右居中bottom left左下bottom center靠下居中bottom right右下

    5.背景图片固定(background-attachment)

    background-attachment:取值; background-attachment属性取值 属性值说明scroll随元素一起滚动(默认值)fixed固定不动

     

    Processed: 0.018, SQL: 9