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?
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.
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 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.
You need to set the z-index to be lower than the menus z-index.
time {
z-index: 900;
}
menu {
z-index: 950;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With