HTML and CSS Basic courses (eight) design a button for your Web page

Source: Internet
Author: User

This class is mainly about how to use div to simulate a button.

Some of the new properties are used:

Border-radius

Adds a rounded border to a DIV element, such as

border-radius:5px;

Margin

Set all the margin properties in a single declaration, properties can set 1~4 values, for example:

margin:10px 5px 15px 20px;

The outer margin is 10px.

The right outer margin is 5px

Lower outer margin is 15px

Left outer margin is 20px

margin:10px 5px 15px;

The outer margin is 10px.

The right outer margin and the left outer margin are 5px

Lower outer margin is 15px

margin:10px 5px;

The top and outer margins are 10px

The right outer margin and the left outer margin are 5px

margin:10px;

All 4 outer margins are 10px

Margin:auto

The browser calculates the outer margin.

Text-align

The horizontal alignment of the text in the specified element. For example

Value Description

Left aligns the text to the left-hand side. Default value: is determined by the browser.

Right aligns the text to the right-hand side.

Center arranges the text in the middle.

More Wonderful content: http://www.bianceng.cn/web/Html/

Justify to achieve justified text effects.

div {

Text-align:center;

}

Indicates that the text inside the div container will be centered.

Stylesheet.css

img {  
    display:block;  
    height:100px;  
    width:300px;  
    Margin:auto;  
}  
      
p {  
    text-align:center;  
    Font-family:garamond, serif;  
    font-size:18px;  
}  
      
/*start Adding your CSS below!*/  
div {  
    height:50px;  
    width:120px;  
    border: #6495ED;  
    Background-color: #BCD2EE;  
    border-radius:5px;  
    Margin:auto;  
    Text-align:center;  
          
}  
      
a {  
    text-decoration:none;  
}

Index.html

<! DOCTYPE html>  
Related Article

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.