CSS red square on top - css

I use a zoom tools with javascript and I have an issue with the CSS part because of the lens.
I would like the red square (a video link) to always be on top by modifying only the CSS if possible. But I am not able to do it, the lens hide always the element no matter the z-index attribute I affect to each class...
Have you some idea?
You can see the code HTML and CSS on the following link :
http://jsfiddle.net/8scpq7vz/
.cloudzoom-blank {
z-index: 10;
width: 465px;
height: 465px;
}
.cloudzoom-lens {
border: 1px solid #000;
width: 200px;
height: 200px;
cursor: move;
z-index: 10;
}
.product-essential {
position: relative;
top: 0;
left: 0;
}
.product-essential-b1 {
float: left;
}
.product-img-box {
position: relative;
z-index: 3;
float: left;
width: 465px;
margin-left: 16px;
background: #FFF;
}
.product-img-box .product-image {
width: 465px;
height: 465px;
padding: 0px;
border: 2px solid #E8E8E8;
background: #FFF;
}
.product-img-box .product-image div {
position: relative;
}
.product-img-box .product-image img#image {
position: relative;
width: 465px;
height: 465px;
opacity: 0.85;
}
.product-img-box .video {
position: absolute;
left: 10px;
top: 10px;
z-index: 100;
cursor: pointer;
}
.v2 {
float: left;
width: 41px;
height: 41px;
text-indent: -9999px;
background: #F22;
}
<div class="product-essential">
<div class="product-essential-b1">
<div class="product-img-box">
<p class="video" id="video-btn">
<a target="_blank" class="v2">Video</a>
</p>
<div class="ldesktop">
<div id="product-media">
<div class="product-image">
<div>
<img src="https://i.pinimg.com/474x/9d/d3/e5/9dd3e53d4d13d5000ef67028c8b03998.jpg" id="image">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cloudzoom-blank" style="position: absolute; top: 28px; left: 29px;">
<div class="cloudzoom-lens" style="overflow: hidden; position: absolute; top: 27px; left: 15px;">
<img style="position: absolute; left: -18px; top: -46px; max-width: none; width: 465px; height: 465px;" src="https://i.pinimg.com/474x/9d/d3/e5/9dd3e53d4d13d5000ef67028c8b03998.jpg">
</div>
</div>
Thank you.

Simply remove z-index from product-img-box to avoid creating a stacking context and be able to place the red square on the top:
.cloudzoom-blank {
z-index: 10;
width: 465px;
height: 465px;
}
.cloudzoom-lens {
border: 1px solid #000;
width: 200px;
height: 200px;
cursor: move;
z-index: 10;
}
.product-essential {
position: relative;
top: 0;
left: 0;
}
.product-essential-b1 {
float: left;
}
.product-img-box {
position: relative;
float: left;
width: 465px;
margin-left: 16px;
background: #FFF;
}
.product-img-box .product-image {
width: 465px;
height: 465px;
padding: 0px;
border: 2px solid #E8E8E8;
background: #FFF;
}
.product-img-box .product-image div {
position: relative;
}
.product-img-box .product-image img#image {
position: relative;
width: 465px;
height: 465px;
opacity: 0.85;
}
.product-img-box .video {
position: absolute;
left: 10px;
top: 10px;
z-index: 100;
cursor: pointer;
}
.v2 {
float: left;
width: 41px;
height: 41px;
text-indent: -9999px;
background: #F22;
}
<div class="product-essential">
<div class="product-essential-b1">
<div class="product-img-box">
<p class="video" id="video-btn">
<a target="_blank" class="v2">Video</a>
</p>
<div class="ldesktop">
<div id="product-media">
<div class="product-image">
<div>
<img src="https://i.pinimg.com/474x/9d/d3/e5/9dd3e53d4d13d5000ef67028c8b03998.jpg" id="image">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cloudzoom-blank" style="position: absolute; top: 28px; left: 29px;">
<div class="cloudzoom-lens" style="overflow: hidden; position: absolute; top: 27px; left: 15px;">
<img style="position: absolute; left: -18px; top: -46px; max-width: none; width: 465px; height: 465px;" src="https://i.pinimg.com/474x/9d/d3/e5/9dd3e53d4d13d5000ef67028c8b03998.jpg">
</div>
</div>
Related:
Why can't an element with a z-index value cover its child?
I have position but z index is not working

Have you tried this adding position:fixed to you .v2 class? Like this:
.v2 {
float: left;
width: 41px;
height: 41px;
text-indent: -9999px;
background: #F22;
position: fixed;
}
Not sure if that's what you looking for, but seems to be.

The video element's parent element product-essential is having lower z-index (0 as default) to it's sibling cloudzoom-blank. So elements in cloudzoom-blank is displayed above any element inside product-essential. (also if both have equal z-index, then one specified last will be on top)
You can change the arrangement of the elements if it is possible

Related

CSS make child to topmost using z-index

https://codepen.io/anon/pen/QZVVbY
I want the code above of the green box to be topmost.
But apparently, it's under another small z-index container.
I don't want to change parent z-index. How to achieve this?
Not to change the z-index of parent and other parent
.container{
width: 500px;
height: 50px;
}
.container1 {
background: red;
width: 500px;
height: 50px;
position: relative;
z-index: 2;
}
.container2 {
background: blue;
width: 50px;
height: 50px;
position: relative;
}
.container3 {
background: green;
width: 50px;
height: 50px;
position: absolute;
top: 30px;
left: 20px;
z-index: 2200000;
}
.container4 {
background: yellow;
width: 500px;
height: 50px;
position: absolute;
top: 0;
left: 20px;
z-index: 5;
}
.container5 {
background: gray;
width: 50px;
height: 50px;
position: absolute;
top: 15px;
left: 40px;
}
<div class="container1">
<div class="container2"></div>
<div class="container3"></div>
</div>
<div class="container4">
<div class="container5"></div>
</div>
The issue is that having a z-index on container1 is creating a layer stack. This results in all child elements with a z-index to be relative to the parents z-index. In order to make this work removing the z-index style from container will get the effect you're wanting.
.container{
width: 500px;
height: 50px;
}
.container1 {
background: red;
width: 500px;
height: 50px;
position: relative;
}
.container2 {
background: blue;
width: 50px;
height: 50px;
position: relative;
}
.container3 {
background: green;
width: 50px;
height: 50px;
position: absolute;
top: 30px;
left: 20px;
z-index: 999999;
}
.container4 {
background: yellow;
width: 500px;
height: 50px;
position: absolute;
top: 0;
left: 20px;
z-index: 5;
}
.container5 {
background: gray;
width: 50px;
height: 50px;
position: absolute;
top: 15px;
left: 40px;
}
<div with z-index=1 class="container1" >
<div class="container2"></div>
<div with z-index=100 class="container3" ></div>
</div>
<div with z-index=2 class="container4" >
<div class="container5"></div>
</div>

How can I make another skew container inside a skewed parent container using css

I am creating a simple layout using skews and my layout is like this:
And what I desired is something like this:
My problem is I can't make another div with skew inside the parent container.
Here's my CSS and HTML:
/*** VCONTENT ***/
#v-container {
position: relative;
background: #000;
}
#homepage-content-banner {
margin-top: 50px;
margin-bottom: 90px;
position: relative;
text-align: center;
z-index: 0;
background: #000;
}
#homepage-content-banner h1 {
font-family: times new roman;
color: #fff;
font-size: 80px;
margin-top: 35%;
}
#homepage-banner-images {
background-image: url('../images/top-banner-full.png');
background-repeat: no-repeat;
position: relative;
padding-left: 0px;
padding-right: 0px;
max-width: 100%;
max-height: 100%;
background-size: 100%;
height: 950px;
min-height: 950px;
margin-bottom: 150px;
}
#scroll-bottom {
color: #fff;
margin-top: 16%;
font-family: blueHighway;
}
#scroll-bottom:hover {
cursor: pointer;
color: #FFF100;
}
#homepage-about-us {
height: 300px;
position: relative;
width: 100%;
padding-left: 0px;
padding-right: 0px;
background: #fff;
}
#homepage-about-us::before {
content: '';
width: 100%;
height: 100%;
position: absolute;
background: inherit;
z-index: 0;
bottom: 0;
transform-origin: left top;
transform: skewY(-10deg);
}
<div id="v-container">
<div class="container-fluid" id="homepage-content-banner">
<div class="row">
<div class="col-md-12" id="homepage-banner-images">
<h1 class="headline">EVERYTHING IN THE WORLD IS<br />UNDER THE SAME SKY</h1>
<div id="scroll-bottom">
<h4>SCROLL</h4>
<div class="fa fa-long-arrow-down fa-2x"></div>
</div>
</div>
</div>
</div>
<div class="container-fluid" id="homepage-about-us">
<div class="inner-line">
<div class="img"></div>
</div>
</div>
</div>
Can you help me with this?
You can create a second item with skewY with ::after:
/*** VCONTENT ***/
#v-container {
position: relative;
background: #000;
}
#homepage-content-banner {
margin-top: 50px;
margin-bottom: 90px;
position: relative;
text-align: center;
z-index: 0;
background: #000;
}
#homepage-content-banner h1 {
font-family: times new roman;
color: #fff;
font-size: 80px;
margin-top: 35%;
}
#homepage-banner-images {
background-image: url('../images/top-banner-full.png');
background-repeat: no-repeat;
position: relative;
padding-left: 0px;
padding-right: 0px;
max-width: 100%;
max-height: 100%;
background-size: 100%;
height: 950px;
min-height: 950px;
margin-bottom: 150px;
}
#scroll-bottom {
color: #fff;
margin-top: 16%;
font-family: blueHighway;
}
#scroll-bottom:hover {
cursor: pointer;
color: #FFF100;
}
#homepage-about-us {
height: 300px;
position: relative;
width: 100%;
padding-left: 0px;
padding-right: 0px;
background: #fff;
}
#homepage-about-us::before {
content: '';
width: 100%;
height: 100%;
position: absolute;
background: inherit;
z-index: 0;
bottom: 0;
transform-origin: left top;
transform: skewY(-10deg);
}
#homepage-about-us::after {
content: '';
width: 100%;
height: 100%;
position: absolute;
background: yellow;
z-index: 0;
bottom: 0;
transform-origin: left top;
transform: skewY(-10deg);
}
<div id="v-container">
<div class="container-fluid" id="homepage-content-banner">
<div class="row">
<div class="col-md-12" id="homepage-banner-images">
<h1 class="headline">EVERYTHING IN THE WORLD IS<br />UNDER THE SAME SKY</h1>
<div id="scroll-bottom">
<h4>SCROLL</h4>
<div class="fa fa-long-arrow-down fa-2x"></div>
</div>
</div>
</div>
</div>
<div class="container-fluid" id="homepage-about-us">
<div class="inner-line">
<div class="img"></div>
</div>
</div>
</div>

CSS Blur Image Effect

I'm trying to have an image in the body of the page that's full width. Not a background. On the Center of this image id like a bar that blurs and darkens the background image. Then id like words on the bar.
Here is what i got:
#superimagecontainer {
position: relative;
height: auto;
}
#container4 {
position: absolute;
left: 0px;
width: 100%;
height: auto;
overflow: hidden;
z-index: 0;
}
#container4 img {
width: 100%;
position: relative;
z-index: 0;
}
#container4b {
position: absolute;
top: 50%;
left: 0px;
width: 100%;
height: 100px;
overflow: hidden;
z-index: 1;
}
#container4b img {
width: 100%;
position: relative;
filter: blur(3px) brightness(50%);
}
h8 {
position: absolute;
top: 50%;
left: 0;
width: 100%;
color: #fff;
padding: 18px;
font-size: 25px;
letter-spacing: 10px;
opacity: 0.75;
}
<div id="superimagecontainer">
<div id="container4">
<img src="img/buildings750.jpg" alt="" />
</div>
<div id="container4b">
<img src="img/buildings750.jpg" alt="" />
<h8>THIS IS THE BEST TEXT SAMPLE EVER</h8>
</div>
</div>

CSS apply border to a cloud shape?

I drew a cloud via CSS3 using different div tags I am trying to add a border to the whole shape but I am having trouble since every shape get its own border how can I apply a border to the whole cloud?
HTML:
<div id="cloud">
<div id="bottom_c"></div>
<div id="right_c"></div>
<div id="left_c"></div>
</div>
CSS:
* {
margin: 0;
padding: 0;
border: 0;
}
body{
background-color: #4ca3ff;
}
#cloud {
position: absolute;
}
#bottom_c {
position: relative; top: 200px; left: 500px;
width: 350px;
height: 150px;
background-color: #fff;
border-radius: 100px;
border: solid 5px black;
z-index: 100;
}
#right_c{
position: absolute; top: 140px; left: 640px;
width: 150px;
height: 150px;
border-radius: 100%;
background-color: #fff;
border: solid 5px black;
}
#left_c{
position: absolute; top: 170px; left: 550px;
width: 100px;
height: 100px;
border-radius: 100%;
background-color: #fff;
border: solid 5px black;
}
Image:
You can do it without any additional elements. Just use the ::before and ::after pseudo-elements with the same size and round shape as the top cloud bubbles. z-index keeps everything in the right layer.
Demo:
Output:
CSS:
body{
background-color: #4ca3ff;
}
#cloud {
height: 230px;
margin: 40px;
position: relative;
width: 400px;
}
#cloud div {
border: solid 5px black;
}
#bottom_c {
background-color: #fff;
border-radius: 100px;
height: 150px;
position: absolute;
top: 100px;
width: 350px;
z-index: 0;
}
#right_c{
background-color: #fff;
border-radius: 100%;
height: 150px;
left: 140px;
position: absolute;
top: 40px;
width: 150px;
z-index: -1;
}
#left_c{
background-color: #fff;
border-radius: 100%;
height: 100px;
left: 50px;
position: absolute;
top: 70px;
width: 100px;
z-index: -1;
}
#cloud::before {
background-color: white;
border-radius: 50%;
content: '';
height: 100px;
left: 55px;
position: absolute;
top: 75px;
width: 100px;
z-index: 1;
}
#cloud::after {
position: absolute; top: 45px; left: 145px;
background-color: white;
border-radius: 50%;
content: '';
width: 150px;
height: 150px;
z-index: 1;
}
HTML:
<div id="cloud">
<div id="bottom_c"></div>
<div id="right_c"></div>
<div id="left_c"></div>
</div>
Thank you for the original solution! I needed to create multiple clouds and dynamically resize and recolor them, so I adapted to original solution as follows:
I made the clouds resizable by using percentages values for the height, width, top and left properties. The .cloud class uses padding-top to adjust the height of the cloud relative to the cloud's width.
I made the :before and :after pseudo-elements divs.
I changed the id selectors to class selectors
And I reorganized the properties so they're easier to read.
I hope this helps someone. Here's the code:
Output
I don't yet have the reputation to post images :/. So here's a link to the output: http://imgur.com/nN9dBiQ
CSS:
.cloud {
position: relative;
width: 100%;
padding-top: 57.5%;
box-sizing: border-box;
}
.cloud_bottom,
.cloud_left,
.cloud_right {
border: solid 5px black;
}
.cloud_bottom,
.cloud_left,
.cloud_right,
.cloud_leftCircle,
.cloud_rightCircle {
background-color: #fff;
}
.cloud_bottom {
position: absolute;
top: 43.48%;
height: 65.2%;
width: 87.5%;
border-radius: 100px;
z-index: 0;
}
.cloud_left {
position: absolute;
top: 30.43%;
left: 12.5%;
height: 43.48%;
width: 25%;
border-radius: 100%;
z-index: -1;
}
.cloud_right {
position: absolute;
top: 17.39%;
left: 35%;
height: 65.2%;
width: 37.5%;
border-radius: 100%;
z-index: -1;
}
.cloud_leftCircle {
position: absolute;
top: 32.61%;
left: 13%;
height: 43.48%;
width: 25%;
border-radius: 50%;
z-index: 1;
}
.cloud_rightCircle {
position: absolute;
top: 23.48%;
left: 35%;
height: 65.21%;
width: 37.5%;
border-radius: 50%;
z-index: 1;
}
HTML:
<div class="firstCloud cloud">
<div class="cloud_bottom"></div>
<div class="cloud_left"></div>
<div class="cloud_right"></div>
<div class="cloud_leftCircle"></div>
<div class="cloud_rightCircle"></div>
</div>
<div class="secondCloud cloud">
<div class="cloud_bottom"></div>
<div class="cloud_left"></div>
<div class="cloud_right"></div>
<div class="cloud_leftCircle"></div>
<div class="cloud_rightCircle"></div>
</div>
JavaScript:
function updateCloudColor(cloudElement, color) {
cloudElement.children().css("background-color", color);
}
$(window).load(function () {
updateCloudColor($(".firstCloud"), "red");
updateCloudColor($(".secondCloud"), "blue");
});

anchor tag not responding

My anchor tag is not responding (my mouse does not respond to the link as a link, for example) within the #contentAboutMe... through research I found that the z-index may affect this... However, I commented out anything with a z-index, and it doesn't seem to be the issue.
Any ideas? I would appreciate any help. (anchors are working else where in my mark-up)
#logo {
position: absolute;
top: 50px;
left: 20px;
/*z-index: 50;*/
}
#mainHeader > h1 {
font-size: 18px;
}
#wrapperAboutMe {
position: absolute;
width: 525px;
left: 400px;
top: 40px;
/*z-index: 2;*/
}
#placeHolder {
position: relative;
}
#topAboutMe {
background-image: url(../images/aboutTopBackground.png);
width: 525px;
height: 47px;
}
#contentAboutMe {
width: 525px;
background-image: url(../images/aboutMainBackground.png);
}
#contentAboutMe p {
padding: 0 40px 0 40px;
text-align: justify;
}
.firstCharacter {
display: block;
float: left;
color: #155763;
font-size: 330%;
line-height: .5em;
padding-top: 10px;
padding-right: 2px;
}
#bottomAboutMe {
background-image: url(../images/aboutBottomBackground.png);
width: 525px;
height: 71px;
}
#aboutImage {
width: 220px;
height: 45px;
background-image: url(../images/graphicAbout_03.png);
background-repeat: no-repeat;
float: left;
padding: 30px 0 0 0;
position: absolute;
top: -25px;
left: -100px;
}
#aboutImage span {
display: none;
}
#aboutBackground {
position: absolute;
background-image: url(../images/graphicAboutBackground.png);
width: 462px;
height: 125px;
left: -260px;
top: -110px;
z-index: 1;
}
HTML:
<article id="aboutMe">
<div id="wrapperAboutMe">
<div id="topAboutMe"> </div>
<!--End topAboutMe-->
<div id="contentAboutMe">
<p><span class="firstCharacter">M</span>y content</p>
View My Resume
</div>
<!--End contentAboutMe-->
<div id="bottomAboutMe"> </div>
<!--End bottomAboutMe-->
<div id="placeHolder">
<h1 id="aboutImage"><span>About Me</span></h1>
<div id="aboutBackground"></div>
<!--End aboutBackground-->
</div>
<!--End placeHolder-->
</div>
<!--End wrapperAboutMe-->
</article>
<!--End Article_aboutMe-->
Your div with the id of aboutBackground, is over the top of your link, so when you try to click, it's actually registering against that div, isntead of the link.
To fix this, change the #aboutBackground z-index to -1, so it will look like so:
#aboutBackground {
position: absolute;
background-image: url(../images/graphicAboutBackground.png);
width: 462px;
height: 125px;
left: -260px;
top: -110px;
z-index: -1; // this line edited
}
​
just get rid of this style
#placeHolder {
position: relative;
}
This brings the element on top of your link

Resources