I have this code inserted into one my blocks.
<div data-content="FOR GIRLS" class="image">
<img src="path_to_image"
alt="" />
</div>
<p></p>
<div data-content="FOR BOYS" class="image">
<img src="path_to_image"
alt="" />
</div>
tryed to link the image to post URL, in this way:
<div data-content="FOR GIRLS" class="image">
<a href="link_to_post"><img src="path_to_image"
alt="" /></a>
</div>
<p></p>
<div data-content="FOR BOYS" class="image">
<a href="link_to_post"><img src="path_to_image"
alt="" /></a>
</div>
but when save the changes image still is not linked nowhere..
This is CSS for image class:
.image img {
width:100%;
vertical-align:top;
height:95%;
}
.image:after, .image:before {
position:absolute;
opacity:0;
transition: all 0.5s;
-webkit-transition: all 0.5s;
}
.image:after {
content:'\A';
width:100%; height:100%;
top:0; left:0;
background:rgba(0,0,0,0.6);
}
.image:before {
content: attr(data-content);
width:100%;
color:#fff;
z-index:1;
bottom:0;
padding:0px 10px;
text-align:center;
background:black;
box-sizing:border-box;
-moz-box-sizing:border-box;
padding-bottom: 5px;
}
.image:hover:after, .image:hover:before {
opacity:1;
}
I dont know what is wrong, and why i cant link image in that way. Some tips?
Try this for html:
<div data-content="FOR GIRLS" class="image">
<a class="wrapped__link" href="link_to_post"> </a>
<img src="path_to_image" alt="" />
</div>
and for css:
div.image {
position: relative;
}
.wrapped__link {
position: absolute;
z-index: 3;
display: block;
height: 100%;
width: 100%;
text-decoration: none;
color: transparent;
}
Related
I am trying to get text to display under my overlapping images. I have two images side by side which are to be voted on so the "VS" image overlaps the other two images in the middle which works perfectly. When I try to get text to display under each image to be voted on, however, it seems to display towards the top behind the images, not underneath as it would normally.
Here's a codepen of what it does at the moment:
http://codepen.io/anon/pen/qdemaz
html:
<div align="center">
<div id="vs">
<img id="png1" src="/puppies/8.jpg" /><p
class="left">username<br>Description<br>Puppies name</p>
<img id="png2" src="/images/vs.png" />
<img id="png3" src="/puppies/8.jpg" /><p
class="right">username<br>Description<br>puppies name</p>
</div>
</div>
css:
#png1 {
position:absolute;
top:30px;
left:0;
z-index:0;
}
#png2 {
position:absolute;
top:100px;
left:260px;
z-index:1;
}
#png3 {
position:absolute;
top:30px;
left:315px;
z-index:0;
}
#vs{
position: relative;
width: 620px;
height: 310px;
}
p.left{
position:absolute;
top:315px;
left:0px;
z-index:4;
text-align:left;
}
p.right{
position:absolute;
top:315px;
left:315px;
z-index:4;
text-align:left;
}
I think I see what you're looking to do. You're setup isn't the best. I reworked the HTML/CSS, is this what you want:
http://codepen.io/anon/pen/pJMeGr
a{
display: inline-block;
vertical-align: top;
position: relatve;
z-index: 9;
}
img{
display: inline-block;
border: 1px solid #333;
}
.left{
margin-right: -15px;
}
.right{
margin-left: -10px;
}
#vs{
text-align: center;
}
.vs{
display: inline-block;
vertical-align: top;
position: relative;
z-index: 10;
border: 1px solid #000;
margin-top: 8px;
}
<div>
<div id="vs">
<a class="left" href="#"><img src="http://placehold.it/120x120" />
<br>puppies name
<br>username
<br>Description
</a>
<img class="vs" src="http://placehold.it/100x100" />
<a class="right" href="#"><img src="http://placehold.it/120x120" />
<br>puppies name
<br>username
<br>Description
</a>
</div>
</div>
http://www.habib-fadel.com/en/artwork/
Please could someone tell me how to do this hover state.
This is my HTML at the moment:
<div class="grid-item">
<a href="#">
<div class="details">
<div class="title">Portrait VII</div>
<div class="icon-cross icon"></div>
</div>
</a>
<img src="images/1.jpg">
</div>
HTML
<div class="grid-item">
<a href="#" class="hoverItem">
<div class="details">
<div class="title">Portrait VII</div>
<div class="icon-cross icon"></div>
</div>
</a>
<img src="http://www.habib-fadel.com/data/oeuvres_2716d/fiche/62/vign_kaa_1528_4cf8a.jpg">
</div>
CSS
.grid-item {
width:200px;
position:relative;
}
.grid-item:hover a{
transform: scale(1);
}
.grid-item img {
width:100%;
}
.grid-item a {
display:block;
background-color:red;
top:0px;
position:absolute;
width:200px;
height:100%;
transform: scale(0);
transition:0.2s linear all;
}
.grid-item .title {
text-align: center;
width: 100%;
display: block;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
http://jsfiddle.net/ort52qzd/2/
I have been trying to add an overlay play icon to my videos which all works however after adding this im getting a weird 1px spacing on the bottom row of my images
When the absolute positioning is removed from (#icon) the images align perfectly - but when added back it adds the weird spacing
Could anybody help with this?
CODE: http://www.codeply.com/go/JC75OR4xpD
HTML CODE:
<div class="instaVideos">
<h1>Short Videos</h1>
<a href="http://scontent-lhr3-1.cdninstagram.com/hphotos-xaf1/t50.2886-16/11661388_407770589406910_367605487_n.mp4" class="html5lightbox">
<img src="https://igcdn-photos-c-a.akamaihd.net/hphotos-ak-xaf1/t51.2885-15/11325016_1163164417043690_1908545167_n.jpg"/>
<img id="icon" src="img/youtubePlayIcon.png"/>
</a>
<a href="http://scontent-lhr3-1.cdninstagram.com/hphotos-xtp1/t50.2886-16/1489765_333969910114258_1680134671_n.mp4" class="html5lightbox">
<img src="https://igcdn-photos-h-a.akamaihd.net/hphotos-ak-xfa1/t51.2885-15/10706968_601233316654119_1567865956_n.jpg"/>
<img id="icon" src="img/youtubePlayIcon.png"/>
</a>
<a href="http://scontent-lhr3-1.cdninstagram.com/hphotos-xaf1/t50.2886-16/10679292_519402934860781_468618633_n.mp4" class="html5lightbox">
<img src="https://igcdn-photos-e-a.akamaihd.net/hphotos-ak-xaf1/t51.2885-15/10665576_441425795996740_1661178998_n.jpg"/>
<img id="icon" src="img/youtubePlayIcon.png"/>
</a>
<a href="http://scontent-lhr3-1.cdninstagram.com/hphotos-xfp1/t50.2886-16/10641919_684721938283340_2079757675_n.mp4" class="html5lightbox">
<img src="https://igcdn-photos-g-a.akamaihd.net/hphotos-ak-xap1/t51.2885-15/924582_890120924350870_1658010424_n.jpg"/>
<img id="icon" src="img/youtubePlayIcon.png"/>
</a>
<a href="http://scontent-lhr3-1.cdninstagram.com/hphotos-xfp1/t50.2886-16/10541299_371884109631916_1548975081_n.mp4" class="html5lightbox">
<img src="https://igcdn-photos-c-a.akamaihd.net/hphotos-ak-xpa1/t51.2885-15/10538735_664550930296554_1249448005_n.jpg"/>
<img id="icon" src="img/youtubePlayIcon.png"/>
</a>
<a href="https://scontent-lhr3-1.cdninstagram.com/hphotos-xaf1/t50.2886-16/11683107_112731029066100_1538573428_n.mp4" class="html5lightbox">
<img src="https://igcdn-photos-e-a.akamaihd.net/hphotos-ak-xfa1/t51.2885-15/11386568_1455668744729300_108311835_n.jpg"/>
<img id="icon" src="img/youtubePlayIcon.png"/>
</a>
<a href="http://scontent-lhr3-1.cdninstagram.com/hphotos-xfp1/t50.2886-16/10721731_1471532036461241_1447645097_n.mp4" class="html5lightbox">
<img src="https://igcdn-photos-h-a.akamaihd.net/hphotos-ak-xpa1/t51.2885-15/10724656_765518650158719_1752400817_n.jpg"/>
<img id="icon" src="img/youtubePlayIcon.png"/>
</a>
<a href="http://scontent-lhr3-1.cdninstagram.com/hphotos-xfa1/t50.2886-16/11679305_467034590127593_1579081935_n.mp4" class="html5lightbox">
<img src="https://igcdn-photos-e-a.akamaihd.net/hphotos-ak-xaf1/t51.2885-15/11429736_699224963557660_1457167025_n.jpg"/>
<img id="icon" src="img/youtubePlayIcon.png"/>
</a>
</div>
CSS:
.instaVideos {
margin:0 auto;
margin-left: auto;
margin-right: auto;
max-width: 800px;
width:90%;
text-align: center;
margin-bottom: 50px;
transition:all .2s ease-in-out;
}
.instaVideos > h1 {
margin:0 auto;
text-align: left;
width:300px;
margin-left: 2%;
font-size: 30px;
font-family: 'raleway';
}
.instaVideos > a > img {
width:150px;
height:auto;
margin-top: 5px;
border:1px solid red;
text-align: center;
}
.instaVideos a:hover {
opacity: 0.7;
}
.instaVideos > a {
position:relative;
}
#icon {
width:auto;
height:30px;
position:absolute !important;
left:35%;
top:0px;
right:0px;
display:inline !important;
}
SOLVED
I fixed this by doing the follwing:
.instaVideos {
position:relative;
}
#icon {
position: absolute;
left:0;
right:0;
top:0;
margin: 0 auto;
}
Maybe this help you: Fiddle
CSS:
.instaVideos > a {
position: relative;
height: 100%;
width: auto;
display: inline-block;
}
#icon {
width:auto;
height:30px;
position:absolute !important;
left:50%;
top:50%;
transform: translate(-50%, -50%);
}
I have a div that holds content in it that has a relative position and is restricted by 980px width. I'm trying to give this div a background image banner that will spread out 100% width of the screen. I can't seem to figure it out.
The div that I'm trying to throw the image is #design-background that should be the background of div #bottom-content
Thanks in advance:
JSFiddle: https://jsfiddle.net/74j0o4mx/
<div id="container-content">
<div id="content">
<div id="all-content">
<div id="top-content">
<div id="top-left-content">
<div class="content-body" role="main" aria-label="Main Content Area"><div class="editorContent"><div style="font-family: ralewayregular; font-size: 120%; color: #a5610b; line-height: 200%; text-align: justify;">
<p>stuff</p>
</div></div><div style="clear:both;"></div></div> </div>
<div id="top-right-content">
<p>stuff</p>
</div>
<div id="bottom-content">
<div id="design-background">
</div>
<div id="bottom-left-content">
<div id="bottom-left-top">
<a href="#">
<img src="/images/layout/layoutImg4.jpg" alt="" width="304" height="194"> <h3>EXAMPLE</h3>
</a>
</div>
<div id="bottom-left-bottom">
<a href="#">
<img src="/images/layout/layoutImg3.jpg" alt="" width="304" height="195"> <h3>EXAMPLE</h3>
</a>
</div>
</div>
<div id="bottom-center-content">
<div id="bottom-center">
<a href="#">
<img src="/images/layout/layoutImg5.jpg" alt="" width="311" height="406"> <h3>EXAMPLE</h3>
</a>
</div>
</div>
<div id="bottom-right-content">
<div id="bottom-right-top">
<a href="#">
<img src="/images/layout/layoutImg1.jpg" alt="" width="308" height="195"> <h3>EXAMPLE</h3>
</a>
</div>
<div id="bottom-right-bottom">
<a href="#">
<img src="/images/layout/layoutImg2.jpg" alt="" width="308" height="195"> <h3>EXAMPLE</h3>
</a>
</div>
</div>
</div>
<div id="bottom-text-content">
<p>stuff</p>
</div>
</div>
</div>
</div>
</div>
CSS:
#design-background{
position:absolute;
height:350px;
top:50%;
left:0px;
right:0px;
margin-top: -175px;
background: url('../images/background-dec.jpg');
}
#content{
position:relative;
margin: 0 auto;
left:0;
right:0;
width:980px;
}
#all-content{
display:block;
position:relative;
width:98.9%;
margin: 0 auto;
}
#top-content{
margin: 0 0 0 13px;
position:relative;
display:block;
width:98.9%;
min-height: 165px;
}
#top-left-content{
position:relative;
width:65%;
left:0;
margin-top: 10px;
}
#top-right-content{
position:absolute;
right:0;
top:0;
width:35%;
margin-top: -30px;
text-align: right;
}
#bottom-content{
position:relative;
display:block;
text-align:right;
height:407px;
}
#bottom-left-content{
width:33%;
position:relative;
float:left;
height:407px;
margin-right:3.5px;
}
#bottom-center-content{
position:relative;
width:33.33%;
float:left;
height:407px;
text-align: center;
}
#bottom-right-content{
position:relative;
float:right;
width:33%;
height:407px;
}
#bottom-left-top{
position:absolute;
right:0;
}
#bottom-left-bottom{
position:absolute;
bottom:0px;
right:0;
}
#bottom-right-top{
position:absolute;
right:0;
}
#bottom-right-bottom{
position:absolute;
bottom:0px;
right:0;
}
#bottom-center{
position:absolute;
margin: 0 0 0 12px;
left:0;
right:0;
}
#bottom-text-content{
position:relative;
display:block;
width:100%;
text-align:center;
font-family: Semibold;
color: rgb(165,97,11);
font-size:300%;
vertical-align: middle;
}
#content h3{
display:none;
}
#content a:hover h3{
color:#FFF;
display:block;
position: absolute;
top:50%;
margin-top: -25px;
width:100%;
text-decoration: none;
font-family: ralewayregular;
height:50px;
background-color: rgba(0,0,0,0.7);
text-align: center;
padding-top:25px;
font-size: 200%;
}
#container-content{
position:relative;
margin: 0 auto;
width:100%;
height:100%;
background-color:#FFF;
min-height: 680px;
}
The key is to make sure the parent of #design-background has a position relative value and set to 100% width. Read this to learn how it works.
Important properties:
#content {
position:relative;
}
#all-content {
width:980px;
margin: 0 auto;
}
See the updated demo here - http://jsfiddle.net/rrwjkb3g/
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;
}