Multiple settings in the navigation bar and multiple settings in the navigation bar

Source: Internet
Author: User

Multiple settings in the navigation bar and multiple settings in the navigation bar

Note: For simple people, do not speak quietly .... I am a record.

By default, the webpage has the margin value and padding value, and the subsequent elements do not take effect in the modification process of margin and padding, therefore, in the style setting process, the margin and padding values of all elements are first cleared to 0;

Code: * {padding: 0px; margin: 0px;} // * indicates all

You can set the desired margin and padding values on the subsequent elements to take effect;

For example: (for this reason, the idea is logical, but it is not what you want)

I did this based on the navigation of the imooc website (full hands-on, because I am a newbie and want to give it a try)

Below is the Code Section

<Div class = "nav"> <ul> <li> <a href = "#"> comment </a> </li> <a href = "# "> Q & a </a> </li> <a href =" # "> Notes </a> </li> <a href = "# "> classmate Code </a> </li> </ul> </div>
Css style
* {Margin: 0px; padding: 0px ;}. nav {border-bottom: 1px solid # c0c0c0; width: 1000px; height: 60px; margin-left: 40px; // background-color: # c3ffdd ;} ul li {list-style-type: none; width: 120px; float: left;} li a {display: block; text-decoration: none; color: black; font-family: ""; text-align: center; line-height: 60px;} li a: hover, li a: active {color: # f00 ;} li a: focus {border-bottom: 2px solid # f00 ;}

Previously, the content of my life and death label hover was not on the far left of the bottom border. After the code was set, it was enough.


 

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.