文本等细节类样式处理



background

  • background-color
  • background-image
  • background-repeat
  • background-position
  • background-attachment
  • background-size

透明度

  • filter: alpha(opacity=50); //IE
  • opacity: 0.5;
  • 透明度会影响后代
  • rgba
  • background:rgba(255,0,0,0.5);
  • 如果只是想要背景透明,子元素不透明,可在父元素和子元素中间加一层和父元素一样大小的div,利用 background:rgba()设置透明度

段落样式

  • line-height
  • text-decoration
  • text-indent         //首行文本缩进
  • text-align
  • vertical-align    (支持不好,很少用)
  • word-spacing / letter-spacing
    word-spacing 是单词间间距; letter-spacing是字符间间距。
  • word-wrap / word-break

    word-wrap: 设置长单词能否换行
    word-wrap: break-word;
    word-break: 设置自动换行的处理方法
    word-break: break-all;

字体类

  • color
  • font-family
  • font-size
  • font-style
  • font-weight
  • font: style weight size/line-height family
  • 网络字体

表格

  • table
  • caption
  • tr / td
  • thead / tbody / tfoot
  • col / colgroup
  • rowspan / colspan
  • border
  • border-collapse
  • border-spacing
  • empty-cells

表单是前后端数据传输的主要方式

form

from 元素特有属性

  • action
  • method (get / post)
  • enctype ( 数据传输时的编码类型)
    application/x-www-form-urlencoded; multipart/foem-data; text/plain;

input

input是一个“神奇”的元素,它并不仅仅拥有一种表现形式,可以定义多种形式的输入框,用来让用户“输入”数据。输入框的形式由该元素的type属性来设置。

在这说一下当 input type=”radio” 时,name 属性要设置为同一个属性值。

当表单中存在文件域时,enctype要设置为 multipart/form-data; method要设置为 post。

label

1
2
<p><label for="user">用户名: </label>
<input type="text" id="user" ></p>

为label标签设置for属性,for的属性值为user;为文本域设置id属性,id的属性为user,当用户单击label标签时,文本域会自动处于聚焦状态。

默认聚焦状态会有外边框 ,可以outline: none; 取消。

select.option\optgroup

1
2
3
4
5
6
7
8
9
10
11
12
13
<select>
<option> 1 </option>
<option> 2 </option>
<option> 3 </option>
</select>

<select>
<optgroup>
<option> 1 </option>
<option> 2 </option>
<option> 3 </option>
</optgroup>
</select>

fieldset 与 legend

legend表示fieldset标签的标题,包含于field元素当中


  • disabled
  • checked
  • readonly
  • selected
-------------本文结束感谢您的阅读-------------
hao14293 wechat
交流或订阅,请扫描上方微信二维码