HTML-h、p、a、img标签的使用

1.HTML标题(Heading)

(1)通过<h1> - <h6>等标签进行定义的

示例代码如下:

[html]  view plain  copy
  1. <span style="font-family:Microsoft YaHei;"><html>  
  2. <body>  
  3.     <!--h标签,标题-->  
  4.     <h1>My First Heading</h1>  
  5.     <h1>This is heading-1</h1>  
  6.     <h2>This is heading-2</h2>  
  7.     <h3>This is heading-3</h3>  
  8.     <h6>This is heading-6</h6>  
  9.     <h7>My 7 Headings</h7>  
  10.     <h11>My di 11 Headings</h11>  
  11.   
  12. </body>  
  13. </html></span>  
效果图:


2.HTML段落

(1)通过<p>标签进行定义

示例代码:

[html]  view plain  copy
  1. <span style="font-family:Microsoft YaHei;"><html>  
  2. <body>  
  3.       
  4.     <!--p标签,段落-->  
  5.     <p>My first paragraph.</p>  
  6.     <p>This is 1 paragraph.</p>  
  7.     <p>This is 2 paragraph.</p>   
  8.   
  9.       
  10. </body>  
  11. </html></span>  
效果图:

3.HTML链接

(1)通过<a>标签进行定义

(2)在href属性中,指定链接地址

示例代码:

[html]  view plain  copy
  1. <span style="font-family:Microsoft YaHei;"><html>  
  2. <body>  
  3.     <!--a标签,链接-->  
  4.     <a href = "http://www.baidu.com">This is 1 link.</a>  
  5.     <p><a href="http://www.sina.com">This is 2 link.</a></p>  
  6. </body>  
  7. </html></span>  
展现效果:

4.HTML图像

(1)通过<img>标签进行定义

(2)在src属性中指定图像名称

(3)width属性指定图像的宽度

(4)height属性指定图像的高度

示例代码:

[html]  view plain  copy
  1. <span style="font-family:Microsoft YaHei;"><html>  
  2. <body>  
  3.       
  4.     <!--img标签,图像-->  
  5.     <img src="testimg1.jpg" width="104" height="142">This is a pic.</img>  
  6.     <img src="testimg2.jpg" width="104" height="142"/>  
  7.     <a href="http://www.taobao.com"><img src="testimg1.jpg" width="104" height="142"/></a>  
  8.   
  9. </body>  
  10. </html></span>  
效果:

其中最后一张图片,点击会进入淘宝网页


HTML-h、p、a、img标签小试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值