make element visible for click in html css - html

I have an element (the green color in image)
it has a property
top:-5vw;
Because of this it covers the link in text (1.5% /year) and makes it unclickable.
How do I make it clickable without replacing anything?
I tried using z-index, but that does not work.
Image is of inspect element, so blue colour is region of 2nd element

You can try to use pointer-events: none; on div or use negative z-index like z-index:-1.

z-index is what you are looking for. Z-index has certain things that stop it from acting the way you want it to. common mistakes are setting the position. make sure your positions are not set to static or absolute

Related

Z-index preventing on hover attribute on another element

I have two different elements (div class="") within a larger container.
Let's call them div class="overlay_container" and div class="title." The div class="overlay_container" has a subclass, .image, which creates an overlay over the entire larger container on hover.
The div class="title" has a z-index of 10,000 and lies over .image and therefore over the overlay. Unfortunately, when you hover over "title," the subclass overlay image underneath disappears.
I know the problem is obviously that the "title" div is right over the other divs and therefore the on hover will disappear due to the z-index. But how do I fix this? How do I make it so that when you hover over the "title," the .image overlay still appears?
If your answer involves jQuery, could you please tell me where to put the script (before the /head tag)? Thanks!
Adding pointer-events:none; to the title div might work?
Looks like most browsers recognise it, except for....dun dun dun...IE: http://caniuse.com/#search=pointer-events

Setting the opacity of an element within a div with opacity defined by CSS?

I'm working on a project in which I am using an image as a background for a menu. I have defined classes in my CSS stylesheet that dictate the appearance when items are or are not "selected", meaning the user is not on the page each item is linked to.
I have it structured with a div on top of the image with styles applied to it to make it have a semi-transparent white background, so it looks like that part of the image is highlighted. Each semi-transparent div also contains the text that makes up the link, with a color set to white. I would like the div to keep the opacity, while the text remains at an opacity of "1".
I have tried the method discussed in a similar question (CSS - Apply Opacity to Element but NOT To Text Within The Element) but the method does not seem to work for me.
I've posted the bit of code for the link on JSFiddle at http://jsfiddle.net/Cwca22/uG5y8/ if you'd like to take a look at it.
Thanks in advance for all the help.
If you're looking for a pure CSS solution, and are willing to change your markup a little, take a look at this example:
http://jsfiddle.net/jJ4MZ/3/
It treats each "link" as a combination of separate background and text elements, and then positions them over each other, so that only the background div uses transparency.
If I'm understanding you correctly, you want the background colour of the div to be partially transparent to show the image through, but keep the text opaque? That's simple :3
<div style="background-color: rgba(255,255,255,0.5);">Text</div>
If you want to provide support for browsers that don't allow this format, then you need:
<div style="background: #ffffff; background: rgba(255,255,255,0.5);">Text</div>
Old problem without any standard solutions yet! This is something known to be impossible with today's CSS. The only solution i know of is using JS. Using JS you can catch the mousemove of the affected H# and create/position an element. This new 'over' element should not be a child of the DIV with opacity 0.2.
Once i wrote a jsFiddle for a problem like this. Here it is http://jsfiddle.net/A53Py/5/
Create a same-level element which positions absolutely behind the elements without opacity. No need to tell it's cross browser.
Hope it helps

How do I make sure child elements do not cover up inset shadow?

I have a div element with some child elements, and I'm trying to apply a inset box-shadow the child elements seem to be covering up the box-shadow, here is a jfiddle example:
jsFiddle Demo
If you take away the background-color on the optn class you'll see the inset box shadow there, so my code is valid. So the questions is, how do I make it so the child elements appear under the box-shadow?
Had the same problem, find half-solution (works well if you don't have scroll inside).
You can position background in element under the shadow by placing it inside the :before or :after pseudo-class and setting it z-index: -1. It will do the background part.
But it will create new problem: To position :before element you will need to apply to .optn element "position: relative;" and if you apply "position: relative;" to it it will start to shows from under the rounded corners in Webkit browsers.
If you don't have scroll inside, you can fix it by rounding corners if the first and last .optn element, bit if you want to scroll this content then you unfortunately can't do so.
Anyway there is an example: http://jsfiddle.net/qN99W/
http://jsfiddle.net/wdYpv/3/
Move the background color to the parent.
you can add padding like so: http://jsfiddle.net/jalbertbowdenii/wdYpv/2/
If I'm understanding your own goal correctly, you've already got the answer in your question. ;-) Remove the background-color from optn and add it to optn-group instead.
As you've already discovered, though, if you have a different background color for optn on hover or on active, it's still over top of that inset shadow. The easy and possibly lazy solution is to not modify background-color for those, but to use text-color and other effects (shifting by 1px down, for example). Or if you want the border-radius but for those special cases (hover, active) you can live without the shadow, just set border-radii appropriately.
Other than that, don't let the world brainwash you into thinking that just because we have great new tools in CSS that you can't use images anymore. What you REALLY want to do might still be more easily accomplished with images.
Look at the "pinking shears" effect on numerous webpages, and it's still done with one or more transparent PNGs artfully placed.

overlay on clickable region - CSS

Is there a way I can have a partially transparent image (or anything really) overlay a clickable region using XHTML and CSS?
#thirtydot If you know of a solution
that works in only one browser I still
would love to here it! Although the
more support the better.
You can use pointer-events: none.
Browser support: http://caniuse.com/pointer-events (works everywhere except IE10 and older)
http://jsfiddle.net/QC5Yw/
Wrap the overlay and background in a clickable div, and set the opacity attribute of the overlay to something less than 1.
http://www.w3schools.com/Css/css_image_transparency.asp
No, the top z-index element will have the focus. But you can create another transparent top layer over the overlay layer, this one will be clickable. So:
z-index:1 Content element
z-index:2 Mask/Overlay element
z-index:3 Click element
That's because the browser cannot distinguish where your PNG is transparent. It just takes it as an image and will not pass the focus through if there are transparent pixels in it.
Thats why you can put a completely empty div with fixed with and height and it will be clickable.

How do I make the padding of a link clickable in IE 6?

By default, only the text of links is clickable in IE 6. I’d like to make the entire area inside the link (i.e. including padding) clickable as well.
I also need this area to be transparent, as the link covers half of a photo. Adding a background color makes the padding area clickable, but defeats the object, as the link is hidden.
I could have sworn there was a way to do this.
display: inline-block; usually works for me.
display: inline-block is the correct answer, as Kobi says. There is no div or transparent div behind it, just the link element. When the inline-block attribute is applied to it, any padding (and I think line-height) becomes as if it were part of the link.
I remember having come across the same problem but my recollection is hazy about the proper workaround (and if there even was one).
Can you try giving the link a background-color: transparent or a transparent background image? That might work.
If nothing else helps, give the surrounding element a Javascript onclick attribute, and cursor: pointer to simulate link functionality at least for those with JavaScript.