《Head First HTML与CSS 》笔记-0x1

本文详细介绍HTML和CSS的基础知识,通过实际案例演示如何使用HTML标记语言和CSS样式表创建网页,包括布局设计、图片插入、链接设置等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

目录

 

HTML(HyperText Markup Language)

CSS(Cascading Style Sheets)

Hello World!

Starbuzz Coffee Beverages 

 Starbuzz Coffee Beverages with style

相对路径 

<q>和<blockquote>

void元素

字符实体


  • HTML(HyperText Markup Language)

  • CSS(Cascading Style Sheets)

  • Hello World!

<html>
	<head>
		<title>Head First Lounge</title>
	</head>
	<body>
		<h1>Welcome to the Head First Lounge</h1>
		<img src="drinks.gif">
		<p>
		 Join us any evening for refreshing elixirs,
		 conversation and maybe a game or 
		 two of <em>Dance Dance Revolution</em>.
		 Wireless access is always provided;
		 BYOWS(Bring your own Web server).
		</p>
		<h2>Direction</h2>
		<p>
			You'll find us right in the center of
			downtown Webville.Come join us!
		</p>
	</body>
</html>

 

drinks.gif
drinks.gif
  • Starbuzz Coffee Beverages 

<html>
	<head>
		<title>Starbuzz Coffee Beverages</title>
	</head>
	<body>
		<h1>Starbuzz Coffee Beverages</h1>
		<h2>House Blend,$1.49</h2>
		<p>A smooth,mild blend of coffees fromMexico,
		Bolivia and Guatemala.</P>
		<h2>Mocha Cafe Latte,$2.35</h2>
		<p>Espresso,steamed milk and chocolate syrup.</P>
		<h2>Cappuccino,$1.89</h2>
		<p>A mixture of espresso,milk and foam.</P>
		<h2>Chai Tea,$1.85</h2>
		<p>A spicy drink made with black tea,spices,milk and
		honey.</P>
	</body>
</html>

 

  •  Starbuzz Coffee Beverages with style

<html>
	<head>
		<title>Starbuzz Coffee Beverages</title>
		<style type="text/css">
			body {
				background-color:#d2b48c;
				margin-left:20%;
				margin-right:20%;
				border:2px dotted black;
				padding:10px 10px 10px 10px;
				font-family: sans-serif;
			}
		</style>
	</head>
	<body>
		<h1>Starbuzz Coffee Beverages</h1>
		<h2>House Blend,$1.49</h2>
		<p>A smooth,mild blend of coffees fromMexico,
		Bolivia and Guatemala.</P>
		<h2>Mocha Cafe Latte,$2.35</h2>
		<p>Espresso,steamed milk and chocolate syrup.</P>
		<h2>Cappuccino,$1.89</h2>
		<p>A mixture of espresso,milk and foam.</P>
		<h2>Chai Tea,$1.85</h2>
		<p>A spicy drink made with black tea,spices,milk and
		honey.</P>
	</body>
</html>

 

  • 相对路径 

     

<!--
    目录结构
    root
    |-index.html
    |-images
    |    |-a.jpg
    |-about
    |    |-b.html
    |-others
    |    |-else
    |         |-c.html
-->
<!--当前目录访问子目录-->
<html>
  <head>
    <title>index</title>
  </head>
  <body>
    <img src="images/a.jpg"> 
	<a href="about/b.html">To b.html!</a>
    <a href="others/else/c.html">To c.html!</a>
  </body>
</html>
<!--子目录访问父目录-->
<html>
  <head>
    <title>b</title>
  </head>
  <body>
    <img src="../images/a.jpg"> 
	<a href="../index.html">To index.html!</a>
    <a href="../others/else/c.html">To c.html!</a>
  </body>
</html>
<!--多级子目录访问多级父目录-->
<html>
  <head>
    <title>c</title>
  </head>
  <body>
    <img src="../../images/a.jpg"> 
	<a href="../../index.html">To index.html!</a>
    <a href="../../about/b.html">To b.html!</a>
  </body>
</html>
  • &ltq&gt和&ltblockquote&gt

    <blockqute>是一个块(block)元素,而<q>是一个内联(inline)元素。块元素显示时前后各有一次换行,而内联元素在文本流中总在行内出现。

  • void元素

    空元素,如<br>、<img>

  • 字符实体

    如,<为&lt,>为&gt,&为&amp,©为&copyright

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值