码迷,mamicode.com
首页 > 其他好文 > 详细

如何给超链接设置宽度和高度

时间:2014-09-23 15:16:54      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:css   html   

1、利用display:block属性

   1: <!DOCTYPE html>
   2: <html>
   3: <head>
   4: <meta charset="utf-8" />
   5: <title>a设置宽度和高度</title>
   6: <style>
   7: .abc a{
   8:     display:block;
   9:     width:130px;
  10:     height:30px;
  11:     border:1px solid #000
  12: }
  13: </style>
  14: </head>
  15: <body>
  16:     <div class="abc">
  17:         <a href="#">宽度130,高30</a>
  18:     </div>
  19: </body>
  20: </html>

效果:

bubuko.com,布布扣

2、float:left属性

   1: <!DOCTYPE html>
   2: <html>
   3: <head>
   4: <meta charset="utf-8" />
   5: <title>a设置宽度和高度</title>
   6: <style>
   7: .abc a{
   8:     float:left;
   9:     width:150px;
  10:     height:50px;
  11:     border:1px solid #000
  12: }
  13: </style>
  14: </head>
  15: <body>
  16:     <div class="abc">
  17:         <a href="#">宽度150,高50</a>
  18:     </div>
  19: </body>
  20: </html>

效果:

bubuko.com,布布扣

3、对a设置padding

   1: <!DOCTYPE html>
   2: <html>
   3: <head>
   4: <meta charset="utf-8" />
   5: <title>a设置宽度和高度</title>
   6: <style>
   7: .abc a{
   8:     padding:10px 20px;
   9:     width:150px;
  10:     height:50px;
  11:     border:1px solid #000
  12: }
  13: </style>
  14: </head>
  15: <body>
  16:     <div class="abc">
  17:         <a href="#">宽度150,高50</a>
  18:     </div>
  19: </body>
  20: </html>

效果:

bubuko.com,布布扣

来源:http://www.ido321.com/741.html

如何给超链接设置宽度和高度

标签:css   html   

原文地址:http://blog.csdn.net/u011043843/article/details/39496983

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!