zoukankan      html  css  js  c++  java
  • 【CSS系列】对表单和数据表格应用样式

    表格特有的元素:

    1、summary和caption

    caption用作与表格的标题。summary应用于表格标签,用来描述表格的内容,于image标签的alt文本相似。

    2、thead tbody 和tfoot

    这3个标签可以让开发人员将表格划分为逻辑部分。

    行和列标题应该使用th标记而不是td,但是如果某些内容既是标题又是数据,那么仍然应该使用td,表格标题可以设置值为row或col的scope属性,定义他们是行标题还是列标题。他们还可以设置值rowgroup和colgroup,表示他们与多行或多列相关。

    3、col和colgroup

    虽然tr元素使开发人员能够对整行应用样式,但是很难对整列应用样式。colgroup能够对使用col元素定义的一个或多个列进行分组。

    4、将标签和表单关联起来

    1 <label>email <input name="email" type="text"/></label><!--方式1-->
    2 
    3 <label for="email">email</label>
    4 <input name="email" id="email" type="text"/><!--方式2-->

    5、fieldset元素将表单组合起来

    <form>
      <fieldset>
        <legend>health information</legend>
        height: <input type="text" />
        weight: <input type="text" />
      </fieldset>
    </form>

     1 fieldset{
     2     margin:1em 0;
     3     padding:1em;
     4     border:1px solid #ccc;
     5     background:#f8f8f8;}
     6 legend{
     7     font-weight:bold;}
     8 
     9 <form>
    10 <fieldset>
    11  <legend>Your Contact Details</legend>
    12  <p>
    13  <label for="author">Name:</label>
    14  <input name="author" id="author" type="text"/>
    15  </p>
    16   <p>
    17  <label for="email">Email:</label>
    18  <input name="email" id="email" type="text"/>
    19  </p>
    20   <p>
    21  <label for="url">Web Address:</label>
    22  <input name="url" id="url" type="text"/>
    23  </p>
    24  </fieldset>
    25 </form>

  • 相关阅读:
    base64和Blob的相互转换
    限制文件上传的大小和尺寸
    git将本地项目提交到github
    vue-cli3创建项目时报错
    运行项目是node-sass报错的解决方法
    classList的使用
    将数组扁平化并去除其中重复数据,最终得到一个升序且不重复的数组
    移动端的图片放大
    js获取url中的参数
    HTML5-canvas
  • 原文地址:https://www.cnblogs.com/dream-to-pku/p/6722942.html
Copyright © 2011-2022 走看看