Headfirst HTML and CSS 笔记(1)

220 阅读3分钟

1 认识HTML

1 web语言:开始了解HTML

如何添加注释

<html>
<head></head>
<body>
<!-- 注释-->
</body>
</html>

斜体字

<!DOCTYPE html>
<head>
    <title>HTML and CSS exercise</title>
</head>
<body>
    <em>Hello World</em>
</body>
</html>

认识style元素

<!DOCTYPE html>
<head>
    <title>HTML and CSS exercise</title>
    <style type="text/css">

    
    </style>
</head>
<body>
</body>
</html>

2 认识HTML中的"HT":深入理解超文本

链接

<!DOCTYPE html>
<head>
    <title>HTML and CSS exercise</title>
</head>
<body>
    <a href="ahref.html">跳转</a>
</body>
</html>

向上跳转到父文件夹

<a href="../ahref.html">跳转</a>

3 构建模块

认识<q>元素

<p>You never konw when you'll need a good qoute,how about<q>To be or not to be</q>,<q>Wherever you go, there you are</q>
</p>
<!-- 短引用 -->

增加<blockquote>

<body>
    <h2>July 14,2012</h2>
    <p>I saw some Burma Shave style signs on the
        side of the road today:
    </p>
    <blockquote>
        Passing cars,
        When you can't see,
        May get you,
        A glimpse,
        Of eternity.
    </blockquote>
    <p>
        I definitely won't be passing any cars.
    </p>
</body>
<!--长引用,创建了单独的代码块,把文字缩进,不同浏览器有不同显示-->

<q>和<blockqoute>的不同

<blockqoute>是一个block元素,<q>是一个inline元素。块元素显示像是前后各有一个换行,而内联元素在行内出现。

<br>换行符

        <blockquote>
        Passing cars,         <br>
        When you can't see,   <br>
        May get you,          <br>
        A glimpse,           <br>
        Of eternity.
    </blockquote>

void元素

类似<br>的没有实际内容的元素,比如<img>叫做void元素,没有结束标记。
XHTML中使用<br/>,HTML中使用<br>

构建列表

<ol>
        <li>Walla Walla,WA</li>
        <li>Magic City,ID</li>
        <li>Bountiful,UT</li>
        <li>Last Chance,CO</li>
        <li>Why,AZ</li>
        <li>Truth or Consequences,NM</li>
    </ol>
    <ul>
            <li>Walla Walla,WA</li>
            <li>Magic City,ID</li>
            <li>Bountiful,UT</li>
            <li>Last Chance,CO</li>
            <li>Why,AZ</li>
            <li>Truth or Consequences,NM</li>
    </ul>

  • <ol>和<li>总要一起使用
  • <ol>和<ul>只能包含li元素
  • 列表中可以嵌套列表

定义列表

<dl>
        <dt>Burma Shave Signs</dt>
        <dd>
            Road signs common in the U.S. in
            the 1920s and 1930s advertising shaving
            products.
        </dd>
        <dt>Route 66</dt>
        <dd>
            Most famous road in the U.S. highway
            system.
        </dd>
    </dl>
    <!--<dt>定义术语,<dd>定义描述-->

对应特殊字符的字符实体

>字符的缩写是&gt;<字符的缩写是&lt;&字符的缩写是&amp;
www.unicode.org/charts/

元素区分

内联元素 em img q a
块元素 h1,ul,li,ol,blockqoute
br界定模糊