In this tutorial I will explain how to use background images with a different tags to place them one on top of the other using absolute positioning and z-index. First create a simple structure like for instance: <div id="wrapper"> <h1>Some text with the keywords</h1> <h2>Some more secondary keywords</h2> </div> Now just apply styling to it:: body { font-family: Verdana Arial Helvetica sans-serif; margin: 0px; padding: 20px 0px 20px 0px; text-align: center; } #wrapper { padding: 0px; width: 800px; margin: 0px auto 0px auto; height: 300px; position: relative; } h1 h2 { text-indent: -999999px; display: block; margin: 0px; padding: 0px; font-size: 11px; position: absolute; overflow: hidden; background-attachment: scroll; background-repeat: no-repeat; background-position: 0px 0px; } h1 { background-image: url(01.gif); height: 228px; width: 222px; left: 50px; top: 30px; z-index: 0; } h2 { background-image: url(02.gif); height: 201px; width: 141px; left: 210px; top: 40px; z-index: 1; } In this example we are using wrapper with relative position and h1 and h2 tags which will display our images in the background. h1 and h2 tags have absolute position text-indent of -999999px (this is to get read of the text inside of the tags) hidden overflow and block display. These are main elements which make the whole magic. Using z-index you can control wether first or second image is display on top of the other. Sorry for the images but I've made them very quickly for demonstrating purposes. You can download them together with this tutorial. Add a comment Name: * Email: * Website: Twitter: Comment (no html allowed): * Add Comment
Explore the groundbreaking MSc Ethnobotany program at the University of Kent, where science and traditional wisdom unite. Find out why it's transform
Explore the most sought-after internship openings this April, perfect for Indian students looking to gain valuable experience and kickstart their care
Choosing the right university for your child with special needs can be challenging. But it's important to remember that your child deserves the same
There’s a huge diversity of sports on show, with basketball, baseball, badminton and rugby union being some of the most popular. This isn’t surpri
Report Spam
Question: Lorem ipsum dolor sit amet consectetur adipisicing elit. Est iure, rerum ad porro debitis odio sequi aliquam. Quis officia nobis accusamus, ut ipsum, inventore autem repudiandae voluptates cupiditate iure aliquid?
9 Answers
155
Register now to access exclusive content & personalised recommendations.
Don't miss out.
Sign up today!
Register now to access exclusive content & personalised recommendations.
Don't miss out.
Sign up today!
Register now to access exclusive content & personalised recommendations.
Don't miss out.
Sign up today!