Hover placement issue - css

I am trying to create a box - in this case I've called it #rollover in the CSS & HTML - that has four images on the left side. When the end user rolls over each image on the left a larger version of the image appears to the right. The problem I am having is keeping the larger image on the right within the #rollover div.
CSS
#rollover{
width:739px;
height: 600px;
border: 3px solid;
padding-top:10px;
padding-left: 40px;
padding-bottom:10px;
float:left;}
.picture {
width:150px;
height: 150px;}
.picture a.small, .picture a.small:visited {
display:block;
text-decoration:none;
background:#ffffff;
top:0;
left:0;
border:0;}
.picture a img {
border:0;}
.picture a.small:hover {
text-decoration:none;
background-color:#000000;
color:#000000;}
.picture a .large {
display:block;
width:0;
height:0;
border:0;
top:0;
left:0;}
.picture a.small:hover .large {
position:absolute;
top:0;
width:550px;
height:550px;
left:160px;}
body{
margin:0;}
#main{
width:800px;
margin-left:auto;
margin-right:auto;}
#mast{
width:799px;
height:300px;
margin-top: 10px;
padding-top: 5px;
background-image: url(IFhalllogo.png);
background-repeat:no-repeat;}
#insidewrap{
width:749px;
margin:0;
padding:0;
border: 3px solid;
float:left;
border-color: #39C;}
HTML
<div id="rollover">
<div class="picture">
<a class="small" href="#nogo" title="small image"><img src="op/01-thumb.jpg" title="small image" />
<img class="large" src="op/01-large.jpg" title="large image" /></a>
</div>
<div class="picture">
<a class="small" href="#nogo" title="small image"><img src="op/02-thumb.jpg" title="small image" />
<img class="large" src="op/02-large.jpg" title="large image" /></a>
</div>
<div class="picture">
<a class="small" href="#nogo" title="small image"><img src="op/03-thumb.jpg" title="small image" />
<img class="large" src="op/03-large.jpg" title="large image" /></a>
</div>
<div class="picture">
<a class="small" href="#nogo" title="small image"><img src="op/04-thumb.jpg" title="small image" />
<img class="large" src="op/04-large.jpg" title="large image" /></a>
</div>
</div>

Just to document: the solution here was to use position: absolute on the full size images, taking care to relative-position the container to make sure the images where positioned relative to that element:
#rollover{
position: relative;
/* ... */
}
.picture a.small:hover .large {
position:absolute;
top:0;
left:160px;
/* ... */
}

Try using absolute positioning on the hover event.
Here is the code, fiddle around with the top and left attributes to get it where you want.
Hope this helps.
CSS:
#rollover{
width:739px;
height: 600px;
border: 3px solid;
padding-top:10px;
padding-left: 40px;
padding-bottom:10px;
float:left;
}
.picture {
width:150px;
height: 150px;
}
.picture a.small, .picture a.small:visited {
display:block;
text-decoration:none;
background:#ffffff;
top:0;
left:0;
border:0;
}
.picture a img {
border:0;
}
.picture a.small:hover {
text-decoration:none;
background-color:#000000;
color:#000000;
}
.picture a .large {
display:block;
visibility:hidden;
}
.picture a.small:hover .large {
display:block;
visibility: visible;
position:absolute;
width:550px;
height:550px;
top:25px;
left:220px;
}
HTML:
<div id="rollover">
<div class="picture">
<a class="small" href="#nogo" title="small image">
<img src="op/01-thumb.jpg" title="small image" />
<img class="large" src="op/01-large.jpg" title="large image" />
</a>
</div>
<div class="picture">
<a class="small" href="#nogo" title="small image">
<img src="op/02-thumb.jpg" title="small image" />
<img class="large" src="op/02-large.jpg" title="large image" />
</a>
</div>
<div class="picture">
<a class="small" href="#nogo" title="small image">
<img src="op/03-thumb.jpg" title="small image" />
<img class="large" src="op/03-large.jpg" title="large image" />
</a>
</div>
<div class="picture">
<a class="small" href="#nogo" title="small image">
<img src="op/04-thumb.jpg" title="small image" />
<img class="large" src="op/04-large.jpg" title="large image" />
</a>
</div>
</div>

Related

How to position overlay above the photo?

I am trying to make the overlap appear on top of the photo instead of under it. Here is a link to my test page - http://kaniamea.com/image.htm
How can I position this correctly and be responsive in the same time?
And here is the code:
<div align="center">
<div class="image-container"> <a href="link"><img src="https://www.hawaiidiscount.com/Portals/0/Skins/HD-custom-design-s/images/activities/oahu_dinner.jpg" height="174" width="231">
<div class="after">This is some content</div>
</a> </div>
<div class="image-container"> <a href="link"><img src="https://www.hawaiidiscount.com/Portals/0/Skins/HD-custom-design-s/images/activities/oahu_dinner.jpg" height="174" width="231">
<div class="after">This is some content</div>
</a> </div>
<div class="image-container"> <a href="link"><img src="https://www.hawaiidiscount.com/Portals/0/Skins/HD-custom-design-s/images/activities/oahu_dinner.jpg" height="174" width="231">
<div class="after">This is some content</div>
</a> </div>
<style>
.image-container {
width:230px;
height:200px;
display:inline-block;
vertical-align:top;
margin-top:4px;
}
.image-container .after {
width:230px;
height:200px;
display:inline-block;
vertical-align:top;
margin-top:4px;
position:absolute;
display: none;
color: #FFF;
}
.image-container:hover .after {
display: block;
background: rgba(0, 0, 0, .6);
}
</style>

2 floating divs on top of 2 centered divs

I'm trying to create something that will allow me to put something on top of images in this case, small images.
basically, it goes like this and both main divs are centered:
http://jsmith.elementfx.com/images/questions.png
tia.
Sorry, here is
HTML
<div id="container">
<div id="left"><img src="" width="130" height="130" style="border:2px solid #72d6fe" /></div>
<div id="leftimage"><h2>963</h2></div>
<div id="right"><img src="" width="130" height="130" style="border:2px solid #72d6fe" /></div>
<div id="rightimage"><h2>434</h2></div>
</div>
CSS
#container{
margin:0px auto;
width:320px;
text-align:center;
margin-bottom:20px;
}
#left {
float:left;
margin-left:15px;
margin-right:20px;
position:relative;
}
#leftimage{
position:absolute;
padding-top:2px;
margin-left:5px;
width:65px;
}
#right {
margin-right:15px;
}
#rightimage{
position:absolute;
padding-top:2px;
width:65px;
}
you have to use z-index and position to acheive it,
DEMO
HTML
<div id="container">
<div id="left"><img src="" width="130" height="130" style="border:2px solid #72d6fe" /></div>
<div id="leftimage"><h2>963</h2></div>
<div id="right"><div id="rightimage"><h2>434</h2></div><img src="" width="130" height="130" style="border:2px solid #72d6fe" /></div>
</div>
CSS
#container{
margin:0px auto;
width:320px;
text-align:center;
margin-bottom:20px;
}
#left {
float:left;
margin-left:15px;
margin-right:20px;
position:relative;
}
#leftimage{
position:absolute;
padding-top:2px;
margin-left:5px;
width:65px;
z-index:1;
}
#right {
position:relative;
margin-right:15px;
}
#rightimage{
margin-left:175px;
position:absolute;
z-index:1000;
}
use this code, the calculation of the width and height of images would be according to your images:
HTML
<div class="container">
<div class="img1">
<img src="https://cdn1.iconfinder.com/data/icons/windows-8-metro-style/128/test_tube.png" width="32" height="32" />
</div>
<div class="img2">
<img src="https://cdn1.iconfinder.com/data/icons/windows-8-metro-style/128/test_tube.png" width="32" height="32" />
</div>
</div>
CSS
.container{
width:270px;
margin:0 auto;
overflow:hidden;
}
.img1,.img2{
width:128px;
height:128px;
background:url(https://cdn1.iconfinder.com/data/icons/windows-8-metro-style/128/test_tube.png);
float:left;
margin-right:10px;
border:1px solid #000;
}
.img2{margin:0;}
DEMO jsfiddle for this
Demo Fiddle - Quad view with 3 layered images
<div class="container start">
<img src="http://www.placehold.it/300/555555"></img>
<div id="base1" class="base">
<img src="http://www.placehold.it/200/654321"></img>
<div id="overlay1" class="overlay">
<img src="http://www.placehold.it/100/123456"></img>
</div>
</div>
</div>
.base {
width: 200px;
height: 200px;
position: relative;
top: -290px;
left: 10px;
}
.overlay {
width:100px;
height:100px;
position: relative;
left: 10px;
top: -190px;
}
.container {
left:100px;
width: 300px;
height: 300px;
margin: 10px;
float: left;
}
.start {
clear: left;
}

Line up Text to top of Image in divs

I'd like to line up the text to the top of the images in my divs.
Currently the title: Webinar, Blog, etc are sitting below the top of the squares. I have a style in there: vertical-align: top; but it's not aligning to the top of the square.
See my Fiddle - http://jsfiddle.net/huskydawgs/e9pZr/
HTML
<div id="wrapper-resources">
<div id="resources_row">
<div class="resources_cell1">
<div class="resources_lt">
<img height="76" src="https://cdn1.iconfinder.com/data/icons/softwaredemo/PNG/256x256/Box_Red.png" width="76" /></div>
<div class="resources_rt">
<p><strong>Webinar</strong></p>
</div>
</div>
<div class="resources_cell2">
<div class="resources_lt">
<img height="76" src="https://cdn1.iconfinder.com/data/icons/softwaredemo/PNG/256x256/Box_Red.png" width="76" /></div>
<div class="resources_rt">
<p><strong>Article</strong></p>
</div>
</div>
<div class="resources_cell3">
<div class="resources_lt">
<img height="76" src="https://cdn1.iconfinder.com/data/icons/softwaredemo/PNG/256x256/Box_Red.png" width="76" /></div>
<div class="resources_rt">
<p><strong>Blog</strong></p>
</div>
</div>
<div class="resources_cell4">
<div class="resources_lt">
<img height="76" src="https://cdn1.iconfinder.com/data/icons/softwaredemo/PNG/256x256/Box_Red.png" width="76" /></div>
<div class="resources_rt">
<p><strong>Market</strong></p>
</div>
</div>
</div>
</div>
CSS
#wrapper-resources {
position:relative;
width:100%;
border: none;
margin: 50px 0 0 0;
}
#resources_row {
height:100%;
white-space:nowrap;
}
.resources_cell1, .resources_cell2, .resources_cell3, .resources_cell4 {
height:100%;
width:25%;
display:inline-block;
white-space:normal;
}
.resources_lt {
height:100%;
width:33%;
display:inline-block;
white-space:normal;
margin-right: 20px;
vertical-align: top;
}
.resources_rt {
height:100%;
width:50%;
display:inline-block;
white-space:normal;
vertical-align: top;
}
/* Fonts */
#wrapper-resources p {
color: #666666;
font-family: 'SegoeRegular', Helvetica, Arial, sans-serif;
font-size: .9em;
line-height: 1.6em;
}
you need to reset margin to 0 for your <p> http://jsfiddle.net/e9pZr/3/
it has by default margin:1em 0; see http://reference.sitepoint.com/css/collapsingmargins for more explanations.

Please help cant center div in css, need assistance

I have exported div tags from photoshop design into dreamweaver using slices, extracted the css from head and created a style sheet. all the div tags in the page have an absolute position set for each of them. I have tried everything i can think of to center all the content on the page and nothing has worked. can someone please take a look at the code and tell me what i am missing.
<HTML>
<html>
<head>
<title>Packet Access</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="css/style_sheet.css" rel="stylesheet" type="text/css" />
</head>
<body style="background-color:#FFFFFF; margin-top: 0px; margin-bottom: 0px;
margin-left: 0px; margin-right: 0px`enter code here`;">
<div id="Table_01">
<div id="topper">
</div>
<div id="Topper-2">
</div>
<div id="search">
<img src="images/search.png" width="133" height="19" alt="">
</div>
<div id="topper-side2"></div>
<div id="topper-side"></div>
<div id="Logo">
<img src="images/Logo.png" width="254" height="37" alt="">
</div>
<div id="side-logo-right"></div>
<div id="under-search"></div>
<div id="index-09"></div>
<div id="navigation">
<img src="images/navigation.png" width="457" height="20" alt="">
</div>
<div id="under-logo"></div>
<div id="under-navigation"></div>
<div id="divider">
<img src="images/divider.jpg" width="1024" height="3" alt="">
</div>
<div id="bg-left">
<img src="images/bg_left.jpg" width="131" height="147" alt="">
</div>
<div id="index-15">
<img src="images/index_15.png" width="764" height="52" alt="">
</div>
<div id="bg-right">
<img src="images/bg_right.jpg" width="129" height="147" alt="">
</div>
<div id="index-17">
<img src="images/index_17.jpg" width="764" height="243" alt="">
</div>
<div id="index-18">
<img src="images/index_18.jpg" width="130" height="519" alt="">
</div>
<div id="index-19">
<img src="images/index_19.jpg" width="1" height="148" alt="">
</div>
<div id="index-20">
<img src="images/index_20.jpg" width="1" height="148" alt="">
</div>
<div id="index-21">
<img src="images/index_21.jpg" width="128" height="519" alt="">
</div>
<div id="index-22">
<img src="images/index_22.png" width="766" height="43" alt="">
</div>
<div id="index-23">
<img src="images/index_23.png" width="12" height="1" alt="">
</div>
<div id="OTT-box">
<img src="images/OTT_box.jpg" width="242" height="99" alt="">
</div>
<div id="index-25">
<img src="images/index_25.png" width="9" height="1" alt="">
</div>
<div id="XFP">
<img src="images/XFP.jpg" width="242" height="99" alt="">
</div>
<div id="index-27">
<img src="images/index_27.png" width="10" height="1" alt="">
</div>
<div id="Cache">
<img src="images/Cache.jpg" width="242" height="99" alt="">
</div>
<div id="index-29">
<img src="images/index_29.png" width="9" height="1" alt="">
</div>
<div id="index-30">
<img src="images/index_30.jpg" width="12" height="327" alt="">
</div>
<div id="index-31">
<img src="images/index_31.jpg" width="9" height="327" alt="">
</div>
<div id="index-32">
<img src="images/index_32.jpg" width="10" height="327" alt="">
</div>
<div id="index-33">
<img src="images/index_33.jpg" width="9" height="327" alt="">
</div>
<div id="index-34">
<img src="images/index_34.png" width="242" height="81" alt="">
</div>
<div id="index-35">
<img src="images/index_35.png" width="242" height="81" alt="">
</div>
<div id="index-36">
<img src="images/index_36.png" width="242" height="81" alt="">
</div>
<div id="index-37">
<img src="images/index_37.jpg" width="242" height="148" alt="">
</div>
<div id="index-38">
<img src="images/index_38.jpg" width="242" height="148" alt="">
</div>
<div id="index-39">
<img src="images/index_39.jpg" width="242" height="148" alt="">
</div>
<div id="footer">Copyright © 2012 Packet Access</div>
</div>
<!-- End Save for Web Slices -->
</body>
</html>
<!--The CSS is below-->
<CSS>
#charset "utf-8";
*{
margin:0;
padding:0;
}
.body {
background-color: #000;
text-align:center; /*For IE6 Shenanigans*/
}
#Table_01 {
margin: 0 auto;
text-align: center;
width: 1024px;
}
#topper {
position:absolute;
left:0px;
top:0px;
width:1024px;
height:10px;
background-color:#000000;
}
#Topper-2 {
position:absolute;
left:0px;
top:10px;
width:763px;
height:6px;
background-color:#000000;
}
#search {
position:absolute;
left:763px;
top:10px;
width:133px;
height:19px;
background-color:#000000;
}
#topper-side2 {
position:absolute;
left:896px;
top:10px;
width:128px;
height:59px;
background-color:#000000;
}
#topper-side {
position:absolute;
left:0px;
top:16px;
width:130px;
height:53px;
background-color:#000000;
}
#Logo {
position:absolute;
left:130px;
top:16px;
width:254px;
height:37px;
}
#side-logo-right {
position:absolute;
left:384px;
top:16px;
width:379px;
height:26px;
background-color:#000000;
}
#under-search {
position:absolute;
left:763px;
top:29px;
width:133px;
height:13px;
background-color:#000000;
}
#index-09 {
position: absolute;
left: 384px;
top: 42px;
width: 55px;
height: 27px;
background-color: #000;
}
#navigation {
position:absolute;
left:439px;
top:42px;
width:457px;
height:20px;
background-color:#000000;
}
#under-logo {
position:absolute;
left:130px;
top:53px;
width:254px;
height:16px;
background-color:#000000;
}
#under-navigation {
position:absolute;
left:439px;
top:62px;
width:457px;
height:7px;
background-color:#000000;
}
#divider {
position:absolute;
left:0px;
top:69px;
width:1024px;
height:3px;
background-color:#000000;
}
#bg-left {
position:absolute;
left:0px;
top:72px;
width:131px;
height:147px;
}
#index-15 {
position:absolute;
left:131px;
top:72px;
width:764px;
height:52px;
}
#bg-right {
position:absolute;
left:895px;
top:72px;
width:129px;
height:147px;
}
#index-17 {
position:absolute;
left:131px;
top:124px;
width:764px;
height:243px;
}
#index-18 {
position:absolute;
left:0px;
top:219px;
width:130px;
height:519px;
}
#index-19 {
position:absolute;
left:130px;
top:219px;
width:1px;
height:148px;
}
#index-20 {
position:absolute;
left:895px;
top:219px;
width:1px;
height:148px;
}
#index-21 {
position:absolute;
left:896px;
top:219px;
width:128px;
height:519px;
}
#index-22 {
position:absolute;
left:130px;
top:367px;
width:766px;
height:43px;
}
#index-23 {
position:absolute;
left:130px;
top:410px;
width:12px;
height:1px;
}
#OTT-box {
position:absolute;
left:142px;
top:410px;
width:242px;
height:99px;
}
#index-25 {
position:absolute;
left:384px;
top:410px;
width:9px;
height:1px;
}
#XFP {
position:absolute;
left:393px;
top:410px;
width:242px;
height:99px;
}
#index-27 {
position:absolute;
left:635px;
top:410px;
width:10px;
height:1px;
}
#Cache {
position:absolute;
left:645px;
top:410px;
width:242px;
height:99px;
}
#index-29 {
position:absolute;
left:887px;
top:410px;
width:9px;
height:1px;
}
#index-30 {
position:absolute;
left:130px;
top:411px;
width:12px;
height:327px;
}
#index-31 {
position:absolute;
left:384px;
top:411px;
width:9px;
height:327px;
}
#index-32 {
position:absolute;
left:635px;
top:411px;
width:10px;
height:327px;
}
#index-33 {
position:absolute;
left:887px;
top:411px;
width:9px;
height:327px;
}
#index-34 {
position:absolute;
left:142px;
top:509px;
width:242px;
height:81px;
}
#index-35 {
position:absolute;
left:393px;
top:509px;
width:242px;
height:81px;
}
#index-36 {
position:absolute;
left:645px;
top:509px;
width:242px;
height:81px;
}
#index-37 {
position:absolute;
left:142px;
top:590px;
width:242px;
height:148px;
#index-38 {
position:absolute;
left:393px;
top:590px;
width:242px;
height:148px;
}
#index-39 {
position:absolute;
left:645px;
top:590px;
width:242px;
height:148px;
}
#footer {
position: absolute;
left: 0px;
top: 738px;
width: 100%;
height: 21px;
background-color: #000000;
font-family: "Helvetica LT Std";
font-size: 14px;
color: #999;
text-decoration: none;
text-align: center;
padding-top: 3px;
padding-bottom: 2px;
}
</style>
To answer the immediate question of how to center everything on the page, change #Table_01 from:
#Table_01 {
margin: 0 auto;
text-align: center;
width: 1024px;
}
to:
#Table_01 {
margin: 0 auto;
text-align: center;
width: 1024px;
position: relative;
}

with div(width:auto) in a div(width:auto)

Hi guys I've got a problem with some div with width:auto.
Here's the HTML:
<div class="greenMenu">
<div class="btn">
<img src="img/image.png" width="57" height="46" />
<div class="area">
<div class="txt">A Lorem ipsum</div>
</div>
</div>
<div class="btn">
<img src="img/image.png" width="57" height="46" />
<div class="area">
<div class="txt">A Lorem ipsum</div>
</div>
</div>
</div>
and the CSS:
.greenMenu {
position:absolute;
top:83px;
left:220px;
width:auto;
height:47px;
background:url(../img/prod-uova-ripMenu.png) left top repeat;
}
.greenMenu .btn {
background:#090;
float:left;
margin-top:1px;
margin-left:6px;
*display:inline;
_display:inline;
width:auto;
height:43px;
position:relative;
}
.greenMenu .btn img {
border:none;
position:absolute;
top:0px;
left:0px;
z-index:2;
}
.greenMenu .btn .area {
background:#53882d;
width:auto;
height:32px;
position:absolute;
top:5px;
left:0px;
z-index:1;
}
.greenMenu .btn .area .txt {
float:left;
margin:7px 13px 0 60px;
}
The problem is: the greenMenu cannot expand its width and in the same time div.btn width is 0.
Don't use following code there:
position: absolute;

Resources