How to set the width and height of a hyperlink and the width of a hyperlink

Source: Internet
Author: User

How to set the width and height of a hyperlink and the width of a hyperlink

1. Use the display: block attribute

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

Effect:

2. float: left attribute

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

Effect:

3. Set padding for

   1: <!DOCTYPE html>
   2: 
   3: 
   4: <meta charset="utf-8" />
5: <title> a. Set the width and height </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: 
  15: <body>
  16:     <div class="abc">
17: <a href = "#"> width: 150, height: 50 </a>
  18:     </div>
  19: </body>
  20: 

Effect:


Source: http://www.ido321.com/741.html

How can I set the width and height of the label through css? The width and height of the label cannot be used directly.

Add display: block; or display: inline-block;
Modify it to block attributes,

How to set the hyperlink background color size

Do you mean to add a background color and a size for a? you can add a background color for.
Display: block style, and then write its width and height to achieve the desired effect,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.