Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CSS Z-index

Featured Replies

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Untitled</title>

</head>

<body>
<style type="text/css">
#one, #two, #three {width: 200px; height: 150px; position: absolute;}
#one {background: #f00; z-index: 1; top: 0px; left: 0px;}
#two {background: #0f0; z-index: 2; top: 40px; left: 40px;}
#three {background: #00f; z-index: 3; top: 60px; left: 80px;}
</style>


<div id="one">one</div>
<div id="two">two</div>
<div id="three">three</div>

</body>
</html>


  • Author

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Untitled</title>

</head>

<body>
<style type="text/css">
#one, #two, #three {width: 200px; height: 150px; position: absolute;}
#one {background: #f00; z-index: 1; top: 0px; left: 0px;}
#two {background: #0f0; z-index: 2; top: 40px; left: 40px;}
#three {background: #00f; z-index: 3; top: 60px; left: 80px;}
</style>


<div id="one">one</div>
<div id="two">two</div>
<div id="three">three</div>

</body>
</html>


 

Thanks.So basically its to do with stacking order?

Yes, its to do with stacking elements. Lev's example is a good one to start off with. Basically, you instruct the browser to place elements in stacking format with Z-index.

 

You can also see a working example at http://www.w3schools.com/css/tryit.asp?filename=trycss_zindex

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.