Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i send an element to the background

Tags:

html

css

I have a problem. On my webpage I have implemented a clock which has absolute position, and is interfering with my dropdown menu.

My html code for the clock is as follows, where txt is a parameter i get from my JavaScript:

<time>
     <div id="txt"></div>
</time>

and my css code is like this:

time{
     border: 2px dashed red;
     font-size: 80px;
     font-family: circle;
     position: absolute;
     top: 15px;
     left: 43%;
     }

Because the clock is in front of my menu I cannot accesss nested unnumbered lists. What can I do to send my clock to the background?

like image 914
71GA Avatar asked Dec 28 '11 05:12

71GA


People also ask

How do you send something to the back in HTML?

Using the CSS property z-index. Give your time element a lower z-index than whatever it is you're wanting to put it behind.

How would you set a background for an element?

To add background color in HTML, use the CSS background-color property. Set it to the color name or code you want and place it inside a style attribute. Then add this style attribute to an HTML element, like a table, heading, div, or span tag.

How do you bring an element to the front in CSS?

How Do I Bring A Div To The Front? The z-index property in CSS should be used. A greater z-index value is placed in front of elements with lower z-index values. To accomplish this, you must first specify a position style (position:absolute, position:relative, or position:fixed) on both/all elements you wish to order.


1 Answers

You need to set the z-index to be lower than the menus z-index.

time {
    z-index: 900;
}

menu {
    z-index: 950;
}
like image 57
natedavisolds Avatar answered Oct 06 '22 00:10

natedavisolds