Make divs scalable and retain their image size - html

Having a slight problem with these two divs. Firstly I would like them to be scalable. I know this is done through using percentages however I everytime I use percentages the divs come out of position. When I use width these are okay in Google Chrome but not IE, however they are obviously not scalable. Additionally I have a gray filter over the images which look seriously out of place if the divs are not perfectly next to eachother.
Please have a look at the code and let me know if I'm doing anything majorly wrong; which I can only presume that I am.
Firstly the link to the Jsfiddle and the full screen look, and now the code, the basic HTML:`
<div class="My-Gems">
<div class="item item-type-double"> <a class="item-hover">
<div class="item-info">
<div class="date">Branding</div>
<div class="line"></div>
<div class="headline">Money Matters</div>
<div class="line"></div>
</div>
<div class="mask"></div>
</a>
<div class="item-img">
<img src="http://s29.postimg.org/8safbuqmf/Money_Matters_Logo_gif.png " style="width:100%;" alt="" />
</div>
</div>
<div class="item item-type-double"> <a class="item-hover" href="https://www.youtube.com/watch?v=S74yj5rnvAo" target="_blank">
<div class="item-info">
<div class="date">Events</div>
<div class="line"></div>
<div class="headline">Metaphon Fitness</div>
<div class="line"></div>
</div>
<div class="mask"></div>
</a>
<div class="item-img">
<img src="http://s29.postimg.org/wrpgkar0n/Metaphon_Fitness.png" />
</div>
</div>
</div>
<!-- end of my-gems-->
`
And the CSS, again basic.
.My-Gems {
width: 100%;
height: 100%;
}
h2.Second-Header {
color: black;
font-weight:400;
font-family:'Abril Fatface', cursive;
font-size: 3em;
margin: 80px;
}
.item {
text-align:center;
float:left;
position:relative;
}
.item, .item-hover, .item-hover .mask, .item-img, .item-info {
width: 600.5px;
height: 600px;
}
.item-hover, .item-hover .mask, .item-img {
position:absolute;
top:0;
left:0;
}
.item-type-double .item-hover {
z-index:5;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity:0;
cursor:pointer;
display:block;
text-decoration:none;
text-align:center;
}
.item-type-double .item-info {
z-index:10;
color:#ffffff;
display:table-cell;
vertical-align:middle;
position:relative;
z-index:5;
}
.item-type-double .item-info .headline {
font-size:2.4em;
font-family:'open sans';
text-transform: uppercase;
width:90%;
margin:0 auto;
}
.item-type-double .item-info .date {
font-size:20px;
font-family:'Canter';
text-transform: uppercase;
}
.item-type-double .item-hover .mask {
background-color:#000;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
opacity:0.5;
z-index:0;
}
.item-type-double .item-hover:hover .line {
width:90%;
}
.item-type-double .item-hover:hover {
opacity:1;
}
.item-img {
width:100%;
z-index:0;
}

First: you have one image with width:100% and another without, which would make one image bigger than the other.
Second: You should NOT use table cell display outside a 'table' otherwise it will work improperly in some browsers (firefox for example)
Third: By specification for the width:100% to work on all browsers it's parent must either be body or have a width setting itself, so each element in the tree must have a width:100%, except the first which should have width:50% for the purposes described, remember to remove margins, paddings and borders from all elements if they're not needed.
This should work: https://jsfiddle.net/r469x2at/17/embedded/result/
Reorganize HTML so we can have dynamic height:
Latest Works
<div class="item item-type-double">
<div class="item-img">
<img src="http://s29.postimg.org/8safbuqmf/Money_Matters_Logo_gif.png " style="width:100%;" alt="" />
</div> <a class="item-hover">
<div class="item-info">
<div class="mycell">
<div class="date">Branding</div>
<div class="line"></div>
<div class="headline">Money Matters</div>
<div class="line"></div>
</div>
</div>
<div class="mask"></div>
</a>
</div>
<div class="item item-type-double">
<div class="item-img">
<img src="http://s29.postimg.org/wrpgkar0n/Metaphon_Fitness.png" style="width:100%;" />
</div> <a class="item-hover" href="https://www.youtube.com/watch?v=S74yj5rnvAo" target="_blank">
<div class="item-info">
<div class="mycell">
<div class="date">Events</div>
<div class="line"></div>
<div class="headline">Metaphon Fitness</div>
<div class="line"></div>
</div></div>
<div class="mask"></div>
</a>
</div>
</div>
<!-- end of my-gems-->
Some CSS changes so we have dynamic height and auto-width:
.item {
text-align:center;
float:left;
position:relative;
width: 50%;
height: 100%;
}
.item-hover, .item-hover .mask, .item-img, .item-info {
width: 100%;
height: 100%;
}
.item-hover, .item-hover .mask {
position:absolute;
top:0;
left:0;
}
.item-type-double .item-hover {
z-index:5;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity:0;
cursor:pointer;
display:block;
text-decoration:none;
text-align:center;
}
.item-type-double .item-info {
z-index:10;
color:#ffffff;
display:table;
position:relative;
z-index:5;
}
.item-type-double .item-info div.mycell {
vertical-align:middle;
height: 100%;
display:table-cell;
}
EDIT: Answer was incomplete, https://jsfiddle.net/r469x2at/17/

I realised that the Alpha Mask hover was slightly overflowing the div which was caused by a small gap due to display:inline.
I thus added this to Gabriel's anwser.
.item-img img {
display:block
}
The final code is as follows, CSS
body, div, h1, h2, h3, h4, h5, h6, p, blockquote, pre, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, th, td, article, aside, figure, footer, header, hgroup, menu, nav, section {
margin: 0;
padding: 0;
border: 0;
}
.My-Gems {
width: 100%;
height: 100%;
}
h2.Second-Header {
color: black;
font-weight:400;
font-family:'Abril Fatface', cursive;
font-size: 3em;
margin: 80px;
}
.item {
text-align:center;
float:left;
position:relative;
}
.item {
width: 50%;
height: 100%;
}
.item-hover, .item-hover .mask, .item-img, .item-info {
width: 100%;
height: 100%;
}
.item-hover, .item-hover .mask {
position:absolute;
top:0;
height:100%;
left:0;
}
.item-type-double .item-hover {
z-index:5;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity:0;
cursor:pointer;
display:block;
text-decoration:none;
text-align:center;
}
.item-type-double .item-info {
z-index:10;
color:#ffffff;
display:table;
position:relative;
z-index:5;
}
.item-type-double .item-info div.mycell {
vertical-align:middle;
height: 100%;
display:table-cell;
}
.item-type-double .item-info .headline {
font-size:2.4em;
font-family:'open sans';
text-transform: uppercase;
width:90%;
margin:0 auto;
}
.item-type-double .item-info .date {
font-size:20px;
font-family:'Canter';
text-transform: uppercase;
}
.item-type-double .item-hover .mask {
background-color:#000;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
opacity:0.5;
z-index:0;
}
.item-type-double .item-hover:hover .line {
width:90%;
}
.item-type-double .item-hover:hover {
opacity:1;
}
.item-img {
width:100%;
z-index:0;
}
.item-img img {
width:100%;
display:block
}
HTML:
<div class="My-Gems">
<h2 class="Second-Header">Latest Works</h2>
<div class="item item-type-double">
<div class="item-img">
<img src="http://s29.postimg.org/8safbuqmf/Money_Matters_Logo_gif.png " alt="" />
</div>
<a class="item-hover">
<div class="item-info">
<div class="mycell">
<div class="date">Branding</div>
<div class="line"></div>
<div class="headline">Money Matters</div>
<div class="line"></div>
</div>
</div>
<div class="mask"></div>
</a>
</div>
<div class="item item-type-double">
<div class="item-img">
<img src="http://s29.postimg.org/wrpgkar0n/Metaphon_Fitness.png" />
</div>
<a class="item-hover" href="https://www.youtube.com/watch?v=S74yj5rnvAo" target="_blank">
<div class="item-info">
<div class="mycell">
<div class="date">Events</div>
<div class="line"></div>
<div class="headline">Metaphon Fitness</div>
<div class="line"></div>
</div>
</div>
<div class="mask"></div>
</a>
</div>
</div>
<!-- end of my-gems-->
body, div, h1, h2, h3, h4, h5, h6, p, blockquote, pre, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, th, td, article, aside, figure, footer, header, hgroup, menu, nav, section {
margin: 0;
padding: 0;
border: 0;
}
.My-Gems {
width: 100%;
height: 100%;
}
h2.Second-Header {
color: black;
font-weight:400;
font-family:'Abril Fatface', cursive;
font-size: 3em;
margin: 80px;
}
.item {
text-align:center;
float:left;
position:relative;
}
.item {
width: 50%;
height: 100%;
}
.item-hover, .item-hover .mask, .item-img, .item-info {
width: 100%;
height: 100%;
}
.item-hover, .item-hover .mask {
position:absolute;
top:0;
height:100%;
left:0;
}
.item-type-double .item-hover {
z-index:5;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity:0;
cursor:pointer;
display:block;
text-decoration:none;
text-align:center;
}
.item-type-double .item-info {
z-index:10;
color:#ffffff;
display:table;
position:relative;
z-index:5;
}
.item-type-double .item-info div.mycell {
vertical-align:middle;
height: 100%;
display:table-cell;
}
.item-type-double .item-info .headline {
font-size:2.4em;
font-family:'open sans';
text-transform: uppercase;
width:90%;
margin:0 auto;
}
.item-type-double .item-info .date {
font-size:20px;
font-family:'Canter';
text-transform: uppercase;
}
.item-type-double .item-hover .mask {
background-color:#000;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
opacity:0.5;
z-index:0;
}
.item-type-double .item-hover:hover .line {
width:90%;
}
.item-type-double .item-hover:hover {
opacity:1;
}
.item-img {
width:100%;
z-index:0;
}
.item-img img {
width:100%;
display:block
}
<div class="My-Gems">
<h2 class="Second-Header">Latest Works</h2>
<div class="item item-type-double">
<div class="item-img">
<img src="http://s29.postimg.org/8safbuqmf/Money_Matters_Logo_gif.png " alt="" />
</div>
<a class="item-hover">
<div class="item-info">
<div class="mycell">
<div class="date">Branding</div>
<div class="line"></div>
<div class="headline">Money Matters</div>
<div class="line"></div>
</div>
</div>
<div class="mask"></div>
</a>
</div>
<div class="item item-type-double">
<div class="item-img">
<img src="http://s29.postimg.org/wrpgkar0n/Metaphon_Fitness.png" />
</div>
<a class="item-hover" href="https://www.youtube.com/watch?v=S74yj5rnvAo" target="_blank">
<div class="item-info">
<div class="mycell">
<div class="date">Events</div>
<div class="line"></div>
<div class="headline">Metaphon Fitness</div>
<div class="line"></div>
</div>
</div>
<div class="mask"></div>
</a>
</div>
</div>
<!-- end of my-gems-->

Related

Images and image's descriptions on the same row (Css Html)

I have a row with 5 images with the description below, but if the descriptions aren't with the same width the images go up and down, not anymore on the same row.
This is my situation:
Html:
<div class="background">
<div class="layer">
<div class="div-diviso-contenitore">
<div class="div-diviso">
<img src="http://77.238.26.244:81/confimi/wp-content/uploads/2017/02/SILVIA-FAIT-2017_980.jpg">
<div class="overlay">
</div>
</div>
<div class="description">
<p style="color:#ffffff; padding-top:10px; font-size:18px; text-align:left;"><b>Silvia Fait</b></p><br>
<p style="color:#20bed0; padding-top:10px; font-size:20px; margin-top:-27px; text-align:left;">Responsabile ufficio internalizzazione</p><br>
<p style="color:#ffffff; padding-top:10px; font-size:18px; margin-top:-27px; text-align:left;">Mail: estero#confimiemilia.it</p><br>
<p style="color:#20bed0; padding-top:10px; font-size:18px; margin-top:-27px; text-align:left;">Linkdein</p><br>
</div>
</div>
<div class="div-diviso-contenitore">
<div class="div-diviso">
<img src="http://77.238.26.244:81/confimi/wp-content/uploads/2017/02/CLAUDIO-ZAMPARELLI-2017_980.jpg">
<div class="overlay">
</div>
</div>
<div class="description">
<p style="color:#ffffff; padding-top:10px; font-size:18px; text-align:left;"><b>Claudio Zamparelli</b></p><br>
<p style="color:#20bed0; padding-top:10px; font-size:20px; margin-top:-27px; text-align:left;">Responsabile ufficio ufficio economico finanziario fiscale</p><br>
<p style="color:#ffffff; padding-top:10px; font-size:18px; margin-top:-27px; text-align:left;">Mail: fiscaletributario#confimiemilia.it</p><br>
</div>
</div>
<div class="div-diviso-contenitore">
<div class="div-diviso">
<img src="http://77.238.26.244:81/confimi/wp-content/uploads/2017/02/ROBERTA-MAGNANI-2017_980.jpg">
<div class="overlay">
</div>
</div>
<div class="description">
<p style="color:#ffffff; padding-top:10px; font-size:18px; text-align:left;"><b>Roberta Magnani</b></p><br>
<p style="color:#20bed0; padding-top:10px; font-size:20px; margin-top:-27px; text-align:left;">Responsabile ufficio commerciale & sviluppo</p><br>
<p style="color:#ffffff; padding-top:10px; font-size:18px; margin-top:-27px; text-align:left;">Mail: relazioniassociative#confimiemilia.it</p><br>
<p style="color:#20bed0; padding-top:10px; font-size:18px; margin-top:-27px; text-align:left;">Linkdein</p><br>
</div>
</div>
<div class="div-diviso-contenitore">
<div class="div-diviso">
<img src="http://77.238.26.244:81/confimi/wp-content/uploads/2017/02/BARBARA-VANNI-2017_980.jpg">
<div class="overlay">
</div>
</div>
<div class="description">
<p style="color:#ffffff; padding-top:10px; font-size:18px; text-align:left;"><b>Barbara Vanni</b></p><br>
<p style="color:#20bed0; padding-top:10px; font-size:20px; margin-top:-27px; text-align:left;">Responsabile ufficio formazione</p><br>
<p style="color:#ffffff; padding-top:10px; font-size:18px; margin-top:-27px; text-align:left;">Mail: formazione#confimiemilia.it</p><br>
<p style="color:#20bed0; padding-top:10px; font-size:18px; margin-top:-27px; text-align:left;">Linkdein</p><br>
</div>
</div>
<div class="div-diviso-contenitore">
<div class="div-diviso">
<img src="http://77.238.26.244:81/confimi/wp-content/uploads/2017/02/SANDRO-CAMPANI-2017_980.jpg">
<div class="overlay">
</div>
</div>
<div class="description">
<p style="color:#ffffff; padding-top:10px; font-size:18px; text-align:left;"><b>Sandro Campani</b></p><br>
<p style="color:#20bed0; padding-top:10px; font-size:20px; margin-top:-27px; text-align:left;">Responsabile ufficio relazioni sindacali</p><br>
<p style="color:#ffffff; padding-top:10px; font-size:18px; margin-top:-27px; text-align:left;">Mail: sindacale#confimiemilia.it</p><br>
<p style="color:#20bed0; padding-top:10px; font-size:18px; margin-top:-27px; text-align:left;">Linkdein</p><br>
</div>
</div>
</dvi>
</div>
Css:
.background {
background-image: url('http://77.238.26.244:81/confimi/wp-content/uploads/2016/08/a.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
height: 100%;
}
.layer {
background-color: rgba(18, 29, 47, 0.96);
background-repeat: repeat;
width: 100%;
height: 100%;
text-align: center;
padding: 200px 20px 200px 20px;
}
.div-diviso {
width: 100%;
position: relative;
}
.div-diviso-contenitore {
width: 17%;
margin: 10px;
display: inline-block;
position: relative;
}
.div-diviso img {
width: 100%;
position: relative;
}
.div-diviso .overlay {
width: 100%;
height: 100%;
position: absolute;
box-sizing: border-box;
top: 0;
left: 0;
background-color: rgba(0,0,0,0.6);
opacity: 0;
transform: scale(0.1);
-webkit-transform: scale(0.1);
-moz-transform: scale(0.1);
-ms-transform: scale(0.1);
-o-transform: scale(0.1);
transition: all 0.5s ease-in-out;
-webkit-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
visibility: hidden;
}
.div-diviso:hover .overlay {
opacity: 1;
transform: scale(1);
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
visibility: visible;
border: 3px solid #ffffff;
transform: border 2.75s;
}
#media (min-width: 768px) and (max-width: 980px) {
.layer {
text-align: center;
}
.div-diviso-contenitore {
width: 47%;
margin: 10px;
}
}
#media (max-width: 767px) {
.layer {
text-align: center;
}
.div-diviso-contenitore {
width: 98%;
margin: 5px;
}
}
This is what I would like:
The problem is occurring because of vertical alignment. Set the value of vertical-align: top; and you will have the expected output.
Plunkr
.div-diviso-contenitore {
width: 17%;
margin: 10px;
display: inline-block;
position: relative;
vertical-align: top;
}
See this fiddle
Add this CSS
.div-diviso-contenitore {
vertical-align: top;
}
First you need to give a specific height to the class div-diviso-contenitore.
Here i have rewritten the class div-diviso-contenitore
.div-diviso-contenitore {
display: inline-block;
height: 400px; // give your specific height value
margin: 10px;
overflow: hidden;
position: relative;
width: 17%;
word-wrap: break-word;
}
What difference from your class is
height: 400px;
word-wrap: break-word;
overflow: hidden;
Check this fiddle : https://jsfiddle.net/ganesh16889/wfe58x97/

On the opening of new page have a transition effect run

I am designing a website, and for the navigation, it has a transition it goes through, when its hovered over. On hover, it just expands, all of its been done with CSS. I was wondering if there was a way to have the transition effect still occur when you go to a new page, so when you use the navigation and go to a different page on the website, it would be expanded at the start, then transition back to its off hover state.
Heres the HTML
`
Photos And Videos
<nav>
<div id="logo">
<img src="Images/Logo.png" >
</div>
<ul>
<li>
<a href="Index.HTML">
<i class="fa fa-HOME fa-2x"></i> <!--this is using the font awesome icons, reffered to in the head. Multiple divs are used as the websote declared it should be done. Purely used for the icons -->
<span class="nav-text">
HOME
</span>
</a>
</li>
<li>
<a href="standards_&_info.HTML">
<i class="fa fa-info fa-2x"></i>
<span class="nav-text">
STANDARDS & INFORMATION
</span>
</a>
</li>
<li>
<a href="interesting_info.HTML">
<i class="fa fa-magic fa-2x"></i>
<span class="nav-text">
INTERESTING INFORMATION
</span>
</a>
</li>
<li>
<a href="JOBS.HTML">
<i class="fa fa-briefcase fa-2x"></i>
<span class="nav-text">
JOBS
</span>
</a>
</li>
<li>
<a href="photo_&_video.HTML">
<i class="fa fa-picture-o fa-2x"></i>
<span class="nav-text">
PHOTOS & VIDEOS
</span>
</a>
</li>
</ul>
</nav>
<div class="content">
<div class="center">
<h3>Photos</h3>
</div>
<div class="row">
<div class="wrap">
<img src="Images/placeholder.gif" class="media"alt="Berty">
<div class="discription">
<p>Albert </p>
</div>
</div>
<div class="wrap">
<img src="Images/placeholder.gif" class="media"alt="Berty">
<div class="discription">
<p>Albert </p>
</div>
</div>
<div class="wrap">
<img src="Images/placeholder.gif" class="media"alt="Berty">
<div class="discription">
<p>Albert </p>
</div>
</div>
<div class="wrap">
<img src="Images/placeholder.gif" class="media"alt="Berty">
<div class="discription">
<p>Albert </p>
</div>
</div>
</div>
<hr>
<div class="center">
<h3>Videos</h3>
</div>
<div class="row">
<div class="wrap">
<iframe class="media"
src="https://www.youtube.com/embed/u81CTfbc99c">
</iframe>
<div class="discription">
<p>Green Grass</p>
</div>
</div>
<div class="wrap">
<iframe class="media"
src="https://www.youtube.com/embed/u81CTfbc99c">
</iframe>
<div class="discription">
<p>Green Grass</p>
</div>
</div>
<div class="wrap">
<iframe class="media"
src="https://www.youtube.com/embed/u81CTfbc99c">
</iframe>
<div class="discription">
<p>Green Grass</p>
</div>
</div>
<div class="wrap">
<iframe class="media"
src="https://www.youtube.com/embed/u81CTfbc99c">
</iframe>
<div class="discription">
<p>Green Grass</p>
</div>
</div>
</div>
</div>
<footer>
rueregrewghe
</footer>`
Here's the CSS
html, body{
height:100%;
width:100%;
background: rgb(110, 110, 110);
padding:0;
margin:0;
min-width:1280px;
}
.fa-2x{
font-size:2em;
}
.container{
width: 100%;
height: 100%;
}
.fa {
position: relative;
display: table-cell;
width: 60px;
height: 36px;
text-align: center;
vertical-align: middle;
font-size:20px;
}
header{
position:fixed;
margin-left:60px;
width:calc(100% - 60px);
min-width:1400px;
height:108px;
background:rgb(57, 57, 57);
z-index:90;
}
footer{
position:fixed;
bottom:0;
left:0;
width:100%;
height:50px;
background:rgb(57, 57, 57);
min-width:1079px;
}
nav {
background:rgb(255, 90, 9);
position:fixed;
top:0;
height:calc(100% - 50px);
min-height:600px;
left:0;
width:60px;
overflow:hidden;
transform:translateZ(0) scale(1,1);
transition:all .1s linear;
-webkit-transform:translateZ(0) scale(1,1);
-webkit-transition:all .1s linear;
-moz-transform:translateZ(0) scale(1,1);
-moz-transition:all .1s linear;
-ms-transform:translateZ(0) scale(1,1);
float:left;
z-index:100;
}
nav:hover{
width:200px;
transform:translateZ(0) scale(1,1);
transition:all .1s linear;
-webkit-transform:translateZ(0) scale(1,1);
-webkit-transition:all .1s linear;
-moz-transform:translateZ(0) scale(1,1);
-moz-transition:all .1s linear;
-ms-transform:translateZ(0) scale(1,1);;
}
nav li {
position:relative;
display:block;
width:250px;
}
nav li>a {
position:relative;
display:table;
border-collapse:collapse;
border-spacing:0;
color:#efefef;
font-size: 14px;
text-decoration:none;
transform:translateZ(0) scale(1,1);
transition:all .1s linear;
-webkit-transform:translateZ(0) scale(1,1);
-webkit-transition:all .1s linear;
-moz-transform:translateZ(0) scale(1,1);
-moz-transition:all .1s linear;
-ms-transform:translateZ(0) scale(1,1);
-ms-transition:all .1s linear;
transition:all .1s linear;
margin-top: calc(100% / 4);
}
nav .nav-icon {
position:relative;
display: table-cell;
width:60px;
height:36px;
text-align:center;
vertical-align:middle;
font-size:18px;
}
.nav-text {
position:relative;
display: table-cell;
vertical-align:middle;
width:190px;
font-family: 'Droid Serif', serif;
}
nav ul,nav li {
outline:0;
margin:0;
padding:0;
}
.content{
float:right;
margin-top:108px;
top:0;
height:calc(100% - 178px);
position:relative;
width:89%;
min-width:1140px;
margin-left:200px;
padding-top:10px;
}
#one-box{
float:left;
width:50%;
height:100%;
min-width:700px;
margin-left: 20%;
background-color:rgb(179, 107, 0);
height:100%;
min-height:600px
}
.two-box{
float:left;
width:calc(( 80% / 2 ) - 10% );
height:100%;
min-width:395px;
margin-left: 10.5%;
}
.three-box{
float:left;
width:calc(( 85% / 3 ) - 6% );
height:100%;
min-width:240px;
margin-left: 6%;
}
.title{
background-color:rgb(179, 107, 0);
height:70px;
margin-bottom:8%;
margin-top:6%;
width:100%:
}
.center{
margin-left:42%;
width:260px;
height:50px;
background-color:rgb(179, 107, 0);
margin-bottom:15px;
}
.centered{
margin-left:43%;
width:260px;
height:70px;
background-color:rgb(179, 107, 0);
}
.row{
display: inline-block;
height:260px;
width: calc( 100% - 64px );
min-width:1300px;
margin-left:64px;
}
.s_row{
display: inline-block;
height:100px;
width: calc( 100% - 64px );
min-width:1300px;
margin-left:64px;
margin-top:20px;
}
.b_row{
display: inline-block;
height:300px;
width: calc( 100% - 64px );
min-width:1300px;
margin-left:64px;
margin-bottom:10px;
}
.media{
width:300px;
height:200px;
border:0px;
}
.wrap{
width:300px;
height:200px;
float:left;
margin-right: calc((100% - 1200px ) / 4);
}
.discription{
width:300px;
height:30px;
margin-top:20px;
background-color:rgb(179, 107, 0)
}
.info{
background-color:rgb(179, 107, 0);
height:75%;
padding-top:10px;
width:92%;
padding-left:4%;
padding-right:4%;
overflow:hidden;
text-overflow:ellipsis;
}
.infos{
background-color:rgb(179, 107, 0);
height:75%;
padding-top:10px;
width:92%;
padding-left:4%;
padding-right:4%;
min-height:530px;
overflow:hidden;
text-overflow:ellipsis;
}
#experiment{
background-color:rgb(179, 107, 0);
height:100%;
width:65%;
}
hr{
margin-top:40px;
margin-bottom:40px;
opacity: 0.0001;
}
.small_box{
width:300px;
height:100px;
background-color:rgb(179, 107, 0);
float:left;
margin-right: calc((100% - 1200px ) / 4);
}
.box{
width:300px;
height:250px;
background-color:rgb(179, 107, 0);
float:left;
margin-right: calc((100% - 1200px ) / 4);
border-radius:0px 0px 30px 30px;
}
.standard{
width:100%;
min-width:100%;
margin-bottom:100px;
border-spacing:0px;
padding:10px;
}
.standard th {
border-bottom:solid #000000;
padding:20px;
background:rgb(179, 107, 0);
height:100px;
}
.standard td {
border-bottom:dashed #000000;
padding: 0px 10px;
height:170px;
min-height:170px;
width:calc(100% / 3);
min-width:500px;
}
.mid {
border:1px;
border-right:solid #000000;
border-left:solid #000000;
}
.involves{
height:135px;
background-color:rgb(179, 107, 0);
width:100%;
margin-top:0%;
}
.small{
height:30px;
background-color:rgb(179, 107, 0);
width:100%;
margin-top:0%;
margin-bottom:14.5px;
}
.small_ind{
margin-top:0%;
height:30px;
margin-bottom:105px ;
background-color:rgb(179, 107, 0);
width:100%;
}
p{
text-align:center;
font-family: 'Times New Roman', serif;
color:white;
font-size:18px;
}
.read_more{
text-align:center;
font-family: 'Times New Roman', serif;
color:#FF6666;
font-size:18px;
opacity:0.8;
}
h1{
font-family: 'Impact', sans-serif;
text-align:center;
font-size:50px;
color:white;
}
h2{
text-align:center;
font-family: 'Cuprum', sans-serif;
font-size:50px;
color:white;
}
h2{
text-align:center;
font-family: 'Cuprum', sans-serif;
font-size:50px;
color:white;
}
h3{
text-align:center;
font-family: 'Times New Roman', serif;
color:white;
font-size:30px;
}
Here's the JSFiddle http://jsfiddle.net/1ztL2kq4/
Sorry, I am unsure of how to add an additional page to the JSFiddle, if that is even possible. All help is appreciated!
If you like jQuery you can try with this
$( document ).ready(function() {
var timeout;
$(someel).hover(
function() {
timeout = setTimeout(function(){
// do stuff on hover
}, 2000);
},
function(){
clearTimeout(timeout);
// do stuff when hover off
}
);
});
But you just need to add check if its not home page. Hope this will help you :)

Black transparent overlay on image

I'm trying to get a light black overlay on the image when you hover on it (like the text) sorry I'm new to css and HTML!
help would be appreciated
HTML
<div id="con">
<div id="box1">
<p id="text1">
DESTINATIONS
</p>
</p>
<p id="text2">
AMALFI<BR>SORRENTO<BR>POSITANO</a>
</p>
<p id="text3">
THINGS TO DO
</p>
</p>
<p id="text4">
TOURS<BR>MUSUEMS<BR>SHOPPING</a>
</p>
</div>
css
#con {
width:1024px;
height:670px;
background-color: #161717;
}
#box1 {
float: left;
font-size: 25px;
width: 388px;
height: 477px;
background-image: url(media/trying1.png);
background-size: cover;
margin-left: 120px;
margin-top: 90px;
}
#text1 {
z-index:100;
color:white;
font-size:30px;
text-align: center;
margin-top:80px;
line-height:55px;
opacity: 0;
transition: all 0.5s;
}
#box1:hover #text1 {
opacity: 1;
}
This can be done with :before or :after
#box1{
position:relative;
}
#box1:before{
content:'';
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
background:black;
opacity:0;
z-index:0;
}
#box1:hover:before{
opacity:.6;
transition: all 0.5s;
}
#box1 > *{
position:relative;
z-index:1;
}
http://jsfiddle.net/4bo4zju7/3/
CS3 is great! You no longer need JS for simple rollover effects. Gopalraju's above code should work and so does my example below. You can have a fiddle with it and use the code as you see fit.
The parent div, has a black page background, and the imgdiv changes everything inside it to a opacity by 50% on the mouse rolling over the div. In this case the image is inside the div.
There are a few ways of doing this. This is just another one to ad into the mix. Good luck.
.parentdiv {
background-color:#000;
height:100%;
width:100%;
}
.imgdiv {
padding:30px;
}
.imgdiv a{
opacity: 1;
filter: alpha(opacity=100);
-webkit-transition: opacity 0.5s linear;
}
.imgdiv a:hover {
opacity: 0.5;
filter: alpha(opacity=50);
-webkit-transition: opacity 0.5s linear;
}
<div class="parentdiv">
<div class="imgdiv">
<a href="http://www.domain.com.au/link.html">
<img src="http://placehold.it/350x150" alt="image" height="150" width="350">
</a>
</div>
</div>

How can i set a black transperency on hover multiple thumbnail images with each image has a different position?

I'm trying to set multiple black transparency images on hover multiple thumbnail images and each image has a different position. To ensure this, each image has his own class (img1, img2, img3...) with different margins defined.
HTML
<div data-content="Text here" class="image">
<div class="img1">
<img src="../img1">
</div>
</div>
<div data-content="Text here" class="image">
<div class="img2">
<img src="../img2">
</div>
</div>
CSS IMG
.img1 {
height:200px;
position:relative;
margin-top:-10%;
}
.img2 {
height:200px;
position:relative;
left:10%;
}
CSS TRANSPARENCY
.image {
position:relative;
width:200px;
height:200px;
}
.image img {
width:100%;
vertical-align:top;
}
.image:after {
content: attr(data-content);
color:#fff;
position:absolute;
width:100%; height:100%;
top:0; left:0;
background:rgba(0,0,0,0.6);
opacity:0;
transition: all 0.5s;
-webkit-transition: all 0.5s;
}
.image:hover:after {
opacity:1;
}
I think you may have too many wrappers but here is one way with a slightly simpler structure
JSfiddle
HTML
<div class="thumbnail" data-content="Text here">
<img src="http://lorempixel.com/output/people-q-c-200-200-5.jpg"/>
</div>
<div class="thumbnail" data-content="Text here">
<img src="http://lorempixel.com/output/transport-q-c-200-200-6.jpg"/>
</div>>
CSS
.thumbnail {
display: inline-block;
position: relative;
}
.thumbnail a,
.thumbnail a img {
display: block;
}
.thumbnail:after {
content: attr(data-content);
color:transparent;
position:absolute;
width:100%; height:100%;
top:0;
left:0;
background:rgba(0,0,0,0.0);
transition: all 0.5s;
-webkit-transition: all 0.5s;
}
.thumbnail:hover:after {
background:rgba(0,0,0,0.6);
color:#fff;
}

need help in the following html code to make it a flexislider with scrolling 4 images at a time

I need Help guys in making the following code to behave like a flexislider, I have following code which shows 4 images in a row., but i want to add animation o next and previous arrows to it so it should navigate 4 at a time,
I am little lost here please guide
The Following is the HTML
<section id="related" class="row">
<div class="container">
<h1 class="heading1"><span class="maintext">Related Products</span><span class="subtext"> See Our Most featured Products</span></h1>
<ul class="thumbnails">
<li class="span3">
<a class="prdocutname" href="product.html">Product Name Here</a>
<div class="thumbnail">
<span class="sale tooltip-test">Sale</span>
<img alt="" src="img/product1.jpg">
<div class="shortlinks">
<a class="details" href="#">DETAILS</a>
<a class="wishlist" href="#">WISHLIST</a>
<a class="compare" href="#">COMPARE</a>
</div>
<div class="pricetag">
<span class="spiral"></span>ADD TO CART
<div class="price">
<div class="pricenew">$4459.00</div>
<div class="priceold">$5000.00</div>
</div>
</div>
</div>
</li>
<li class="span3">
<a class="prdocutname" href="product.html">Product Name Here</a>
<div class="thumbnail">
<img alt="" src="img/product2.jpg">
<div class="shortlinks">
<a class="details" href="#">DETAILS</a>
<a class="wishlist" href="#">WISHLIST</a>
<a class="compare" href="#">COMPARE</a>
</div>
<div class="pricetag">
<span class="spiral"></span>ADD TO CART
<div class="price">
<div class="pricenew">$4459.00</div>
<div class="priceold">$5000.00</div>
</div>
</div>
</div>
</li>
<li class="span3">
<a class="prdocutname" href="product.html">Product Name Here</a>
<div class="thumbnail">
<span class="offer tooltip-test" >Offer</span>
<img alt="" src="img/product1.jpg">
<div class="shortlinks">
<a class="details" href="#">DETAILS</a>
<a class="wishlist" href="#">WISHLIST</a>
<a class="compare" href="#">COMPARE</a>
</div>
<div class="pricetag">
<span class="spiral"></span>ADD TO CART
<div class="price">
<div class="pricenew">$4459.00</div>
<div class="priceold">$5000.00</div>
</div>
</div>
</div>
</li>
<li class="span3">
<a class="prdocutname" href="product.html">Product Name Here</a>
<div class="thumbnail">
<img alt="" src="img/product2.jpg">
<div class="shortlinks">
<a class="details" href="#">DETAILS</a>
<a class="wishlist" href="#">WISHLIST</a>
<a class="compare" href="#">COMPARE</a>
</div>
<div class="pricetag">
<span class="spiral"></span>ADD TO CART
<div class="price">
<div class="pricenew">$4459.00</div>
<div class="priceold">$5000.00</div>
</div>
</div>
</div>
</li>
</ul>
</div>
the following CSS
#related .thumbnails li:hover .thumbnail img, #category .thumbnails li:hover .thumbnail img, .thumbnails.list li:hover .thumbnail img { transform: scale(1.2, 1.2); -ms-transform: scale(1.2, 1.2); /* IE 9 */ -webkit-transform: scale(1.2, 1.2); /* Safari and Chrome */ -o-transform: scale(1.2, 1.2); /* Opera */ -moz-transform: scale(1.2, 1.2); /* Firefox */ transition: all 0.8s; -ms-transition: all 0.8s; /* IE 9 */ -moz-transition: all 0.8s; /* Firefox 4 */ -webkit-transition: all 0.8s; /* Safari and Chrome */ -o-transition: all 0.8s; /* Opera */ }
.container:after {clear: both;
visibility: hidden;
display: block;
content: "";
clear: both;
height: 0;;}
.thumbnails .prdocutname { font-size:16px; color:#5e626b; text-transform:uppercase; text-align:center; margin:0 0 10px 0; display:block }
.thumbnails.list .thumbnail .prdocutname { font-size:16px; color:#5e626b; text-transform:uppercase; text-align:left; margin:0 0 10px 0; display:block }
.thumbnails.list > li { margin-bottom:40px; padding-bottom:40px; border-bottom:1px solid #ccc }
.thumbnails.list .productdiscrption { margin:10px 0 25px 0 }
.thumbnails.list .thumbnail .shortlinks { display:block; width:auto; position:static; text-align:left; margin:10px 0 25px 0 }
.thumbnails.list .pricetag { margin-left:-15px }
.thumbnail .offer { position:absolute; top:10px; left:-2px; background:url(../img/offer.png) no-repeat 0 0; height:45px; width:68px; float:left; overflow:hidden; display:block; text-indent:9999px }
.thumbnail .sale { position:absolute; top:10px; left:-2px; background:url(../img/sale.png) no-repeat 0 0; height:45px; width:68px; float:left; overflow:visible; display:block; text-indent:9999px;z-index:9999; cursor:pointer; }
.thumbnail .new { position:absolute; top:10px; left:-2px; background:url(../img/new.png) no-repeat 0 0; height:45px; width:68px; float:left; overflow:hidden; display:block; text-indent:9999px }
.thumbnail .pricetag { width:221px; height:37px; background:url(../img/pricetag.png) no-repeat right 0; margin-top:8px; position:relative; padding:9px 9px 9px 40px; margin-bottom:20px }
.thumbnail .pricetag .spiral { position:absolute; top:-19px; left:10px; background:url(../img/spiral.png) no-repeat right 0; height:50px; width:35px }
.thumbnail a.productcart { background: #f25c27 url(../img/prodcutcart.png) right 7px no-repeat; color:#fff; float:right; padding:8px 27px 8px 8px; font-size:13px; }
.thumbnail a.productcart:hover { background: #db420e url(../img/prodcutcart.png) right 7px no-repeat; }
.thumbnail input.productcart_btn { border:none; background: #f25c27 url(../img/prodcutcart.png) right 7px no-repeat; color:#fff; float:right; padding:8px 27px 8px 8px; font-size:13px; }
.thumbnail input.productcart_btn:hover { border:none; background: #db420e url(../img/prodcutcart.png) right 7px no-repeat; }
.thumbnail .shortlinks { background:#fff; position:absolute; left:0; top:60%; width:100%; text-align:center; padding:5px 0; display:none }
.thumbnail .shortlinks a { font-size:12px; padding:5px 5px 0 25px; background:url(../img/sprite.png) 0 0 no-repeat; }
.thumbnail .shortlinks a.details { background-position:0 -384px }
.thumbnail .shortlinks a.wishlist { background-position:0 -423px }
.thumbnail .shortlinks a.compare { background-position:0 -462px }
.thumbnail .shortlinks a.csale { background-position:0 -462px }
.thumbnail .price { float:right; margin-right:19px; text-align:right }
.thumbnail .price .pricenew { font-size:16px; color:#5e626b; font-weight:bold }
.thumbnail .price .priceold { font-size:13px; color:#5e626b; text-decoration:line-through; color:#96979d; }
Do you mean something like cycle : http://jquery.malsup.com/cycle/
or carouFredSel http://caroufredsel.dev7studios.com/
for cycle there are various options but basically you have a container which contains objects
<div class="container">
<div class="object">Html for 4 things</div>
<div class="object">Html for 4 things</div>
etc...
</div>
then you call cycle on the container
$(function(){
$('.continer').cycle();
});
this will now cycle between the objects.
carouFredSel works in a similar way and can divide your objects up for you. i would have a look at the homepage for some examples.
Both require jquery http://jquery.com/ to work.