So i am creating a test webpage but having trouble with getting the :hover command to work properly. No matter what i have tried to do from research seems to work so i am in need of some help.
I am trying to blur out a image and then have text fade in, but i got stuck at having the image blur out using webkit filters. So i stripped it back and just tried changing one colour to another, and even that did not work. What Seems to be the problem?
HTML
#MenuHome {
top:-20px;
right:130px ;
font-size: 40px;
}
#Checkout {
left:190px
}
body {
height:1100px;
}
/*Content*/
#Content {
position:absolute;
top:100px;
width:1100px;
height: 2000px ;
left:50% ;
margin-left: -550px;
background-color: #ecf0f1;
border-radius:15px;
box-shadow:5px 10px 10px rgba(136, 116, 116, 0.31);
z-index: -1
}
#Content_Products {
position:absolute;
top:100px;
width:1100px;
height: 870px ;
left:50% ;
margin-left: -550px;
background-color: #ecf0f1;
border-radius:15px;
box-shadow:5px 10px 10px rgba(136, 116, 116, 0.31);
z-index: -1
}
#TopSection {
position: absolute;
top: 0px;
width: 100%;
Height: 250px;
background-image:url(AboutUsImage.jpg);
border-bottom-style: solid;
border-bottom-color: rgba(60, 231, 178, 0.64);
border-bottom-width: 5px;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
}
#AboutUs1 {
font-family:'Ek Mukta';
color:white;
font-size: 48px;
z-index: 5;
text-align: center;
padding: 50px
}
#Info {
z-index:0;
position: absolute;
top:255px;
width: 1100px;
}
.TelescopesLink {
position:absolute;
display:inline-block;
left:585px;
top:30px;
height:250px;
width:500px;
}
.MountLink {
z-index: 1;
position:absolute;
left:15px;
top:30px;
height:250px;
width:500px;
background-color: green;
}
.MountLink:hover{
z-index: 1;
background-color: red;
}
.AstroLink {
position:absolute;
left:15px;
top:330px;
height:250px;
width:500px;
}
.AccessoriesLink {
position:absolute;
top:330px;
left:585px;
height:250px;
width:500px;
}
/*With the main culprit being */
.MountLink {
z-index: 1;
position:absolute;
left:15px;
top:30px;
height:250px;
width:500px;
background-color: green;
}
.MountLink:hover{
z-index: 1;
background-color: red;
}
<div id="Content_Products">
<div id="TopSection">
<h1 id="AboutUs1">Products</h1>
</div>
<div id="Info">
<div class="TelescopesLink">
<img src="telescopes.jpg" >
</div>
<div class="MountLink">
</div>
<div class="AstroLink">
<img src="astro.jpg" >
</div>
<div class="AccessoriesLink">
<img src="accessories.jpg"</img>
</div>
</div>
</div>
I just cant get it to work, any help or advice would be appreciated
because #Content_Products is positioned absolutely with a minus z-index, the body element is on top of it, so when you hover over the green box, you are actually hovering over the body tag above it.
if you did
body:hover .MountLink{
z-index: 1;
background-color: red;
}
you'll see it work, but the main issue is the z-index:-1 on #Content_Products
z-index is creating problem simply remover z-index form your code and everything will work good..
and css is case sensitive
in #TopSection Height shouldn be height.
Related
I had a successful message popup. Now I want to add a semi-transparent backdrop layer underneath with rgba(0,0,0,0.5), that I used CSS ::before. But the backdrop ::before { rgba(0,0,0,0.5) } seems to overlap my green popup, even when I set z-index and background: !important for the popup.
Here's the code I've tried
.alertMessageModal{ width:auto; height:auto; border-radius:10px; display:inline-block; position:fixed; top:20px; right:25px; color:#fff; padding:10px 15px; padding-bottom:15px; z-index:100; background:green !important;}
.alertMessageModal::before{content:''; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0, 0, 0, 0.5); z-index:-100;}
.alertMessageModal .modal-title{ font-size:15px; float:left; line-height:18px;}
.alertMessageModal .close{ float:right; margin-left:10px; line-height: 15px; color:#fff;}
<div class="alertMessageModal bg-success">
<h4 class="modal-title">Your message has been successfully sent</h4>
<button type="button" class="close">×</button>
</div>
You need to wrap the modal's content inside another extra wrapper div .modal-content. The example from w3school.
Your code doesn't work as expected because z index not working with fixed positioning
Here's the working code, I changed a few lines of code from yours:
/* renamed from .alertMessageModel::before */
.alertMessageModal {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: -100;
}
/* renamed from .alertMessageModal */
.modal-content {
width: auto;
height: auto;
border-radius: 10px;
display: inline-block;
position: fixed;
top: 20px;
right: 25px;
color: #fff;
padding: 10px 15px;
padding-bottom: 15px;
z-index: 100;
background: green !important;
}
.alertMessageModal .modal-title {
font-size: 15px;
float: left;
line-height: 18px;
}
.alertMessageModal .close {
float: right;
margin-left: 10px;
line-height: 15px;
color: #fff;
}
<div class="alertMessageModal bg-success">
<!-- added an extra div -->
<div class="modal-content">
<h4 class="modal-title">Your message has been successfully sent</h4>
<button type="button" class="close">×</button>
</div>
</div>
I am building webpage with school events. On my webpage I am trying to create div(eventContainer) in which I got another div(eventImgContainer) with an image, and this image when hover do an action, e.g. blur or opacity.
The problem is that it does not respond to hover when div with img is inside any other div.
I was looking at syntax related to hover like ">" or "+" or ', '... nothing seams to work. Any ideas why?
I really want to use only css for this/
html:
<div class="eventContainer">
<div class="eventDescription"><!-- here code with event description--></div>
<div class="eventImgContainer">
<img src="1_Zdjecia/event_1/1.jpg" id="Photo1" title="football">
<p class="hidedText">Go to Gallery</p>
</div>
</div>
CSS:
.eventContainer{
z-index: -1;
position:relative;
margin:auto;
left:0;
right:0;
width:700px;
height:270px;
background-color: #E6E6E6;
border: 4px solid white;
}
.eventImgContainer{
position:relative;
width:375px;
height:217px;
top:20px;
left: 305px;
margin:0;
}
.eventImgContainer img {
position:absolute;
width:100%;
display:block;
}
.eventimgcontainer:hover #Photo1 {
opacity:0.5;
width:400;
}
You last css rules is wrong
.eventImgContainer:hover #Photo1 {
opacity: 0.5;
width: 400px;
}
CSS is case sensitive !
And you shouldn't have negative z-index (you should remove the z-index property or set a positive value).
It works for me when I just change z-index: -1; to z-index: 1;
And your last selector (eventimgcontainer) is wrong, should be "eventImgContainer". But your example works also with this lower case selector. The problem is only your z-index.
.eventContainer{
z-index: 1;
position:relative;
margin:auto;
left:0;
right:0;
width:700px;
height:270px;
background-color: #E6E6E6;
border: 4px solid white;
}
.eventImgContainer{
position:relative;
width:375px;
height:217px;
top:20px;
left: 305px;
margin:0;
}
.eventImgContainer img {
position:absolute;
width:100%;
display:block;
}
.eventImgContainer #Photo1 {
opacity:0.5;
width:400;
}
first of all remove the z-index
.eventContainer{
position:relative;
margin:auto;
left:0;
right:0;
width:700px;
height:270px;
background-color: #E6E6E6;
border: 4px solid white;
}
and then correct the name of the class
.eventImgContainer:hover #Photo1{
opacity:0.5;
width:400;
}
I have two divs that overlap horizontally. My issue is that one of the divs contain text and a href link which is not working.
You can see the code I have here
https://jsfiddle.net/jayreis/w7regdcr/
.postwrapper
{
margin:auto;
width:80%;
display:block;
padding-bottom:15px;
}
.imageDiv
{
margin-left: 100px;
background: #fff;
display: block;
width: 445px;
height: 220px;
padding: 10px;
border-radius: 2px 2px 2px 2px;
}
.imageDiv img
{
width:600px;
height:400px;
}
.textboxDiv
{
position:relative;
bottom:145px;
left:470px;
zoom: 1; /*to fix the has layout bug in IE older version*/
filter: alpha(opacity=50);
opacity: 0.9;
background-color:#ffffff;
text-align:center;
}
.textboxDiv:after
{
content:'';
position: absolute;
top: -15px;
left: -15px;
right: -15px;
bottom: -15px;
border: #dddddd 2px solid
}
.readarticle
{
text-decoration:none;
border-top: 1px solid #a61531;
float:left;
color:#000000;
z-index: 99999;
}
<div class="postwrapper">
<div class="imageDiv">
<img src="http://www.ccc.com/media/post/image/6/0/600x400.png" />
</div>
<div class="imageDiv textboxDiv">
<p style="color:#000000; margin-auto; width:35%; margin-left:-10px; padding-bottom:10px">date here
</p>
<h4>the title</h4>
<p style="color:#000000">desc here</p>
<br />
<p><a href="http://www.ccc.com" title="test" class='readarticle'>READ ARTICLE</a></p>
</div>
</div>
So if you look at the css if I change the position: absolute; to be position: relative; in the class style .textboxDiv:after the link then works but I loose the border style I need around the box.
Any suggestions how I can keep the style yet make the links work in the textboxDiv ??
.readarticle is not positioned, so the z-index won't work. Simply add position: relative; and it'll work.
.readarticle
{
text-decoration:none;
border-top: 1px solid #a61531;
float:left;
color:#000000;
z-index: 99999;
+ position: relative;
}
MDN Documentation: Z-Index
i have a problem like this.
#relative{
position:relative;
width:100%;
height:100%;
text-align:center;
}
button{
margin:10px auto;
width:200px;
height:auto;
border:1px solid;
border-radius:5px;
}
#absolute{
position: absolute;
top: 0;
left:0;
height: 250px;
width: 100%;
border: solid 1px #000000;
color: blue;
font-weight: bold;
padding-top: 60px;
/*opacity:0;*/
}
button:hover{
background-color:#eed5a4;
}
<div id="relative">
<button>
Hover me if you can.
</button>
<div id="absolute">
Absolute its me dude!!<br>
If me >> opacity:0<br>
Button still cant be hover.
</div>
</div>
Any solution for this, and i dont know to use the good english language
Note : button keep like this, do not change the position absolute too.
- my english so bad :(
Add position:relative; and a higher z-index than that of the #absolute div to the button itself, like so:
HTML
<button id="relative-button">Hover me if you can.</button>
CSS
#absolute { z-index:1 }
#relative-button { position:relative; z-index:2 }
replace button css like this
button {
border: 1px solid;
border-radius: 5px;
height: auto;
margin: 10px auto;
position: relative; /* newly added */
width: 200px;
z-index: 9; /* newly added */
}
Thanks #daniel lisik, you are awesome people. Extraordinary
#relative{
position:relative;
width:100%;
height:100%;
text-align:center;
}
button{
position:relative;
z-index:5;
margin:10px auto;
width:200px;
height:auto;
border:1px solid;
border-radius:5px;
}
#absolute{
position: absolute;
z-index:1;
top: 0;
left:0;
height: 250px;
width: 100%;
border: solid 1px #000000;
color: blue;
font-weight: bold;
padding-top: 60px;
/*opacity:0;*/
}
button:hover{
background-color:#eed5a4;
}
<div id="relative">
<button>
Hover me if you can.
</button>
<div id="absolute">
Absolute its me dude!!<br>
If me >> opacity:0<br>
Button still cant be hover.
</div>
</div>
I am trying to reproduce this image, with HTML and CSS, but I'm not sure how to place solid images on translucent divs on top of an image. There's one up top and on bottom. And I need a table of these.
http://dl.dropbox.com/u/17949100/house.png
Response to comment: <table> is my lazy way of forcing all the divs to be the same width (and the image). I guess I need to take the text out of the divs and place them, which I also had a hard time doing. Then I worried if use resizes the browser.
Here's what I got so far on jsFiddle. Here's the HTML code:
<table><tr><td>
<img src="http://dl.dropbox.com/u/17949100/samplehouse.png">
<div class="address"><p class="address">804 Rolfe</p></div>
<div class='desc'>
<span class='l'>2 Bedrooms</span>
<span class='r'>$2100</span>
</div>
</td></tr></table>
Here's the CSS file:
div.address {
width:100%;
height:20px;
background-color:#000000;
opacity:0.5;
}
span.l{
width:50%;
font-family:Helvetica;
color:#FFFFFF;
text-align:center;
font-size:75%;
float:left;
margin-top:0px;
}
span.r{
width:50%;
font-family:Helvetica;
color:#FFFFFF;
text-align:center;
font-size:75%;
float:right;
margin-top:0px;
}
div.desc {
width:100%;
height:20px;
background-color:#000000;
opacity:0.5;
}
p.address{
font-family:Helvetica;
height:20px;
opacity:1;
color:#FFFFFF;
text-align:center;
}
The fiddle with markup cleaned and css refactored: http://jsfiddle.net/32szC/4/
Anyway take into serious consideration the suggestion to not use tables for layout purpose: so I made the css working even if you choose to remove the table structure at all using display: inline-block on the .wrapper element (see http://jsfiddle.net/32szC/7/)
HTML
<table>
<tr><td>
<div class="wrapper">
<img src="http://dl.dropbox.com/u/17949100/samplehouse.png" />
<div class="address"><span class="address">804 Rolfe</span></div>
<div class='desc'><span>2 Bedrooms</span><span>$2100</span></div>
</div>
</td></tr></table>
CSS
.wrapper {
position: relative;
height: 100%;
}
.wrapper div {
position: absolute;
z-index: 1;
left: 0;
width: 100%;
background: rgba(0,0,0, .75);
height:20px;
}
div.address { top: 0; }
div.desc { bottom: 0; }
span {
font-family: Helvetica;
text-align:center;
font-size:75%;
color: #fff;
height: 20px;
line-height:20px;
}
.address span {
display: block;
}
.desc span {
width:50%;
float: left;
}
.desc span + span {
float:right;
}
Here's my interpretation of what you should be doing:
http://jsfiddle.net/32szC/8/
HTML:
<div class="product">
<img src="http://dl.dropbox.com/u/17949100/samplehouse.png">
<span class="address">804 Rolfe</span>
<div class='desc'>
<span class='left'>2 Bedrooms</span>
<span class='right'>$2100</span>
</div>
</div>
CSS:
.product {
width: 272px;
height: 220px;
position: relative;
}
.product img {
position: relative;
z-index:1;
}
.address, .desc {
display: block;
width: 252px; /* 272px */
padding: 5px 10px;
position: absolute;
top: 0;
left: 0;
z-index: 2;
background-color: rgba( 0, 0, 0, 0.5);
color: #fff;
}
.desc {
top: auto;
bottom: 0;
overflow: hidden;
}
.desc .left {
float: left;
}
.desc .right {
float: right;
}
Here's my attempt, it includes the shadow border around the image: http://jsfiddle.net/katychuang/2R3hk/
Removed tables to use div. The outer class is "item"
<div class="item">
<div class="address">
<span>804 Rolfe</span>
</div>
<img src="http://dl.dropbox.com/u/17949100/samplehouse.png">
<div class='desc'><span class='l'>2 Bedrooms</span><span class='r'>$2100</span></div>
</div>
And the CSS. It is good to specify the individual widths for .item and .item img, to get them to line up rather than using 100%
.address {
height:20px;
width:inherit;
background: rgba(0, 0, 0, 0.70);
font-family:Helvetica;
color:#FFFFFF;
text-align:center;
z-index:500;
position:absolute;
top:0px;
left:0px;
padding-top:5px;
}
span.l{
width:50%;
font-family:Helvetica;
color:#FFFFFF;
text-align:center;
font-size:75%;
float:left;
}
span.r{
width:50%;
font-family:Helvetica;
color:#FFFFFF;
text-align:center;
font-size:75%;
float:right;
}
.desc {
width: inherit;
background: rgba(0, 0, 0, 0.70);
height: 20px;
z-index: 500;
position: absolute;
bottom: 0px;
left: 0px;
padding-bottom: 5px;
}
.item img {width:250px}
.item {
position:relative;
width: 250px;
margin: auto;
padding: 0px;
-moz-box-shadow: 0px 0px 1em rgba(0, 0, 0, 0.9); /* FF3.5+ */
-webkit-box-shadow: 0px 0px 1em rgba(0, 0, 0, 0.9); /* Saf3.0+, Chrome */
box-shadow: 0px 0px 1em rgba(0, 0, 0, 0.9); /* Opera 10.5, IE 9.0 */
filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=10px, OffY=10px, Color='#888'); /* IE6,IE7 */
-ms-filter: "progid:DXImageTransform.Microsoft.dropshadow(OffX=10px, OffY=10px, Color='#888')"; /* IE8 */
}
body {background-color:#EEEEEE;}
Looks like you just need some negative margins. I would place the address above the image and the description below it. Then something as simple as margin-bottom: -20px will overlap the address over the image.
I made the appropriate changes here jsFiddle