How to form a ladder-shaped web page

Source: Internet
Author: User

I have never noticed a little trick, today there is time, just record, first look at the effect!

1, first in the HTML body, put two div can



<title> New Document </title>
<meta name= "Generator" content= "EditPlus" >
<meta name= "Author" content= "" >
<meta name= "Keywords" content= "" >
<meta name= "Description" content= "" >
<link href= "Style.css" type= "Text/css" rel= "stylesheet" >

<body>
<div class= "Div1" >div1</div>
<div class= "Div2" >div2</div>
</body>

2, then to design CSS style:

*{
padding:0px;
margin:0px;
}

. div1{
width:200px;
height:100px;
Background-color: #f2f6f8;
border:1px solid #000;
border-bottom:0px;
z-index:100;
position:relative;
Text-align:center;
line-height:80px;
}

. div2{
width:600px;
height:200px;
Background-color: #f2f6f8;
border:1px solid #000;
position:relative;
top:-2px;
Text-align:center;
line-height:180px;
}

Observe the green section of the code, set the bottom border of the Div1 to 0, and then, the DIV1 priority to improve some, so that can cover div2, in particular, z-index only with Position:relative/absolute, with the use of only valid, the last step , move the div2 up a little so that it can be completely covered.

How to form a ladder-shaped web page

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.