Python实战-第一节练习项目:动手做自己的网页

最终成果

QQ20160626-0.png

我的代码

<!DOCTYPE html>
<html lang="en">
<head>  <!--网页中不可见 -->
    <meta charset="UTF-8">
    <title>The blah</title>
    <link rel="stylesheet" type="text/css" href="homework.css">  <!-- 引用样式-->
</head>
<body>  <!-- 网页中可见-->
    <div class="header">  <!-- div(划分区域)-->
        <img src="images/blah.png">
        <ul class="nav">  <!-- 无序列表-->
            <li><a href="#">Home</a></li>  <!--li(列表项目),a(连接) -->
            <li><a href="#">Site</a></li>
            <li><a href="#">Other</a></li>
        </ul>
    </div>
    <div class="main-content">
        <h2>The Beach</h2>
        <hr> <!--下划线,只有开始标签,无结束标签-->
        <ul class="photos">
            <li><img src="images/0001.jpg" width="150" height="150" ></li>
            <li><img src="images/0003.jpg" width="150" height="150" ></li>
            <li><img src="images/0004.jpg" width="150" height="150" ></li>
        </ul>
        <p>  <!-- p(插入文字)-->
            stretching from Solta to Mljet, and this unique cycling trip captures the highlights with an ideal
            balance of activity, culture and relaxation. Experience the beautiful island of Korcula with its picturesque old town,
            the untouched beauty of Vis, and trendy Hvar with its Venetian architecture. In the company of a cycling guide,
            this stimulating journey explores towns and landscapes, many of which are on UNESCO's world heritage list.
            Aboard the comfortably appointed wooden motor yacht,
            there is ample time between cycles to swim in the azure waters and soak up the ambience of seaside towns.
        </p>
    </div>
    <div class="footer">
        <p>© Mugglecoding</p>
    </div>
</body>
</html>

总结

  • PyCharm创建网页文件时open选择html所在文件夹(包括.html,.css和images文件夹),问不是点html文件
  • html可以引用样式文件.css
  • 标签可以嵌套标签
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容