html的一些琐碎

(1)元素分为有内容的元素和空元素。前者如<p></p>,后者如<hr />。也可分为块元素和行元素。块元素有标题类块元素(h1~h6)和段落块元素(p,pre,div)pre用于显示诗句以及计算机程序等需要空格回车符来排版的内容 

通用属性

 

id

元素标志属性,大小写敏感,在html文档中必须是唯一的

title

提示的作用,元素设置此属性后当鼠标移到该内容上时就可以看到title的值

(2)table常用的列表项:无需列表ul,有序列表ol,列表项li,其中li常在ul或ol中.常用的表表格元素有:table,tr表格行,td表格单元,th表头.tr的属性有align,valign。th和td的属性有colspan,rowspan,align,valign.

姓名

第一学期

语文

数学

实现上面表格的代码为:

<table border="1px" width="300px">

    <tr> 

        <th rowspan="2">姓名</th>

        <th colspan="2">第一学期</th>

        </tr>

        <tr>

        <th>语文</th>

        <th>数学</th>

         </tr>

    </table>

(3)常用的行元素是img(图像),a(链接),span(通用行),sub(下标),sup(上标),b(粗体),i(斜体),br(换行)。

在超链接标签中name设置书签,可以这样写:

<a name="top"></a>

…………

…………

<a href="#top">返回顶部</a>

在img的src属性中:

如果没有路径名表示图像和当前的html文件处在同一级目录中;

如果是src="image/zhu.jpg"表示zhu.jpg在同级目录image里面;

如果是src="../zhu.jpg"表示zhu.jpg在上一级目录中。

如果是src="../../zhu.jpg"表示zhu.jpg在上上级目录中

向网页中添加flash,音乐用object,param,embed.其中embed中的属性autostart=true表示自动播放;loop=true表示反复播放;src=……表示flash的路径,如:

<embed src="风车与房子.swf" autostart="true" loop="true"></embed>

object以后补充……

(3)表单元素:

input中的type分为text,password,radio,checkbox,submit,reset,button,file(常见的‘浏览’按钮,用于查看上传文件),image(图像按钮)

select下拉框,包含option,可以单选或是多选

label和fieldset(表单控件组),表单控件组中必须包含legend(表单控件组标题)元素

radio:

<input type="radio" name="sex" checked="checked" value="male" />男

<input type="radio" name="sex" value="female" />女

checkbox:

<input value="film" checked="checked" name="favourite"  type="checkbox"/>电影

<input type="checkbox" value="music" checked="checked" name="favourite" />音乐

<input type="checkbox" value="sport" name="favourite" />体育

<input type="checkbox" value="other" name="favourite" />其他

select:

<select name="birth">

   <option value="china" >中国</option>

   <option value="america">美国</option>

   <option value="othercountry">其他</option>

</select>

注意:name表示一个组,value是各自的唯一标志名,并且观察他们实在什么地方写下值

下拉框select要实现列表用size,实现多选用multiple

注意label中for属性的应用:单击label时光标会直接落在for属性指向的元素上,该元素的id属性与label的for属性值相同。

<td><label for="password">密码:</label></td>

<td><input type="password" maxlength="20" id="password"  /></td>

<input type="checkbox" name="favourite" id="movie" value="1" />

<label for="movie">电影</label>

<input type="checkbox" name="favourtie" id="music" value="2" />

<label for="music">音乐</label>

(5)meta元素嵌套在head标记中,用于描述网页的信息,这些信息常被搜索引擎用于检索网页

 

<meta name="description" content="这里是网页的具体描述" />

<meta name="keywords" content="这里是一些关键字" />

<meta name="author" content="这里是作者的名字" />

 

其他的不在细说了

你可能感兴趣的:(html)