I have created three images in column, and i set
column-count: 3;
And i set border-width for those three images. Now i need to know about hover state.
Html:
<div class="wrap">
<h1 class="content-title">
<span>Popular</span>
</h1>
<div class="col-3">
<div class="popular">
<a href="#">
<img src="http://s7.postimg.org/bq6aahcpn/Book_ll_4.jpg" />
</a>
</div>
<div class="caption"><h2>Saina nehwal first match</h2><p>fasdfjaksdksdfh skdfk</p>
</div>
<div class="popular">
<a href="#">
<img src="http://s7.postimg.org/bq6aahcpn/Book_ll_4.jpg" />
</a>
</div>
<div class="caption"><h2>Saina nehwal first match</h2><p>fasdfjaksdksdfh skdfk</p>
</div>
<div class="popular">
<a href="#">
<img src="http://s7.postimg.org/bq6aahcpn/Book_ll_4.jpg" />
</a>
</div>
<div class="caption"><h2>Saina nehwal first match</h2><p>fasdfjaksdksdfh skdfk</p>
</div>
</div>
</div>
When i hover an image, It need to show like this
And here is my worked jsfiddle: http://jsfiddle.net/6g7v899q/
I need something like this [can you please refer this site gatesnotes.com in reading post part?.. I need like this.. ]
May i know, how to do this?
Thanks in advance.
This can be possible with the width and color of the borders on the box, the page you refer has this styles:
.hpunit .hpimgrel .hpbook:hover .gbox {
border-left: 59px solid #ddd;
border-right: 59px solid #ddd;
}
In your code can be like this:
.popular {
display:inline-block;
border:40px solid #eee;
box-sizing:border-box;
}
.popular:hover {
border-left:40px solid gray;
border-right:40px solid gray;
}
<div class="wrap">
<h1 class="content-title">
<span>Popular</span>
</h1>
<div class="col-3">
<div class="popular">
<a href="#">
<img src="http://s7.postimg.org/bq6aahcpn/Book_ll_4.jpg" />
</a>
</div>
<div class="caption"><h2>Saina nehwal first match</h2><p>fasdfjaksdksdfh skdfk</p>
</div>
<div class="popular">
<a href="#">
<img src="http://s7.postimg.org/bq6aahcpn/Book_ll_4.jpg" />
</a>
</div>
<div class="caption"><h2>Saina nehwal first match</h2><p>fasdfjaksdksdfh skdfk</p>
</div>
<div class="popular">
<a href="#">
<img src="http://s7.postimg.org/bq6aahcpn/Book_ll_4.jpg" />
</a>
</div>
<div class="caption"><h2>Saina nehwal first match</h2><p>fasdfjaksdksdfh skdfk</p>
</div>
</div>
</div>
Related
I'm trying to select title with CSS selector.
This is my css
.category-center :nth-last-child(-n+2) {
color: red;
}
<div class="category-center">
<div class="cbp-item-wrapper">
<div class="post-medias">
<a href="" target="_blank">
<img src="#" alt="">
</a>
</div>
<div class="post-info">
<h4 class="post-title">
This is awesome title
</h4>
</div>
</div>
</div>
Can somebody help me with this?
You can use .category-center .post-title a. It will target the <a> element which is inside the element with class post-title which is inside category-center element.
You could even use .post-title a but it will break the hierarchy of CSS which you already have for elements inside .category-center. Also, it will tightly bound the HTML with CSS so when in future if you place the HTML outside of .category-center then the styles will not apply and you will know that something is going wrong with that action.
.category-center .post-title a {
color: red;
}
<div class="category-center">
<div class="cbp-item-wrapper">
<div class="post-medias">
<a href="" target="_blank">
<img src="#" alt="">
</a>
</div>
<div class="post-info">
<h4 class="post-title">This is awesome title</h4>
</div>
</div>
<div class="cbp-item-wrapper">
<div class="post-medias">
<a href="" target="_blank">
<img src="#" alt="">
</a>
</div>
<div class="post-info">
<h4 class="post-title">This is awesome title</h4>
</div>
</div>
<div class="cbp-item-wrapper">
<div class="post-medias">
<a href="" target="_blank">
<img src="#" alt="">
</a>
</div>
<div class="post-info">
<h4 class="post-title">This is awesome title</h4>
</div>
</div>
</div>
Just target the class rather than going specific numnber of children in, as this means if you change your page redesign slightly, it will no longer work.
You can either put a class on your a tag, or target any a tag, on your h4 class, as below.
.post-title a {
color: red;
}
<div class="category-center">
<div class="cbp-item-wrapper">
<div class="post-medias">
<a href="" target="_blank">
<img src="#" alt="">
</a>
</div>
<div class="post-info">
<h4 class="post-title">This is awesome title</h4>
</div>
</div>
</div>
I have been trying to do an image gallery for my portfolio but I want them images without borders and next to each other both horizontally and Vertically. Unfortunately All my attempts have been unsuccessful.
.portfolio {
height: 1250px;
width: 80%;
margin: 0 auto;
background-color: #CF9;
}
#thumbs {
width: 20%;
height: 50px;
color: #090;
float: left;
font-size: 0px;
}
<div class="portfolio">
<div id="thumbs">
<a href="http">
<img src="thumb.png">
</a>
</div>
<div id="thumbs">
<a href="http">
<img src="thumb.png">
</a>
</div>
<div id="thumbs">
<a href="http">
<img src="thumb.png">
</a>
</div>
<div id="thumbs">
<a href="http">
<img src="thumb.png">
</a>
</div>
<div id="thumbs">
<a href="http">
<img src="thumb.png">
</a>
</div>
<div id="thumbs">
<a href="http">
<img src="thumb.png">
</a>
</div>
<div id="thumbs">
<a href="http">
<img src="thumb.png">
</a>
</div>
<div id="thumbs">
<a href="http">
<img src="thumb.png">
</a>
</div>
<div id="thumbs">
<a href="http">
<img src="thumb.png">
</a>
</div>
<div id="thumbs">
<a href="http">
<img src="thumb.png">
</a>
</div>
</div>
http://www.adhemas.com/ is kind of what I'm trying to achieve, except my images are all the same size (although I would not mind a how to make them different sizes but still stacked)
Element IDs should be unique within your entire document. If you have more than one element with the same ID, your HTML is invalid, which is likely to cause your web page to stop working as intended.
Source: Can multiple different HTML elements have the same ID if they're different types?
I suggest you use classes instead, which support having multiple elements with the same class.
Give all your elements a class of thumbs instead of an id. Then you can use .thumbs instead of #thumbs in your CSS rule to style your elements.
First thing to fix is the id. You cannot reuse the id in the html.
Next you need to set the a and the img to be constrained inside the .thumb element.
Something like the following
.portfolio {
height: 1250px;
width: 80%;
margin: 0 auto;
background-color: #CF9;
}
.thumbs {
width: 20%;
color: #090;
float: left;
font-size: 0px;
}
.thumbs a {display:block;}
.thumbs img{width:100%;}
<div class="portfolio">
<div class="thumbs">
<a href="http">
<img src="http://lorempixel.com/500/500/cats/1">
</a>
</div>
<div class="thumbs">
<a href="http">
<img src="http://lorempixel.com/500/500/cats/2">
</a>
</div>
<div class="thumbs">
<a href="http">
<img src="http://lorempixel.com/500/500/cats/3">
</a>
</div>
<div class="thumbs">
<a href="http">
<img src="http://lorempixel.com/500/500/cats/4">
</a>
</div>
<div class="thumbs">
<a href="http">
<img src="http://lorempixel.com/500/500/cats/5">
</a>
</div>
<div class="thumbs">
<a href="http">
<img src="http://lorempixel.com/500/500/cats/6">
</a>
</div>
<div class="thumbs">
<a href="http">
<img src="http://lorempixel.com/500/500/cats/7">
</a>
</div>
<div class="thumbs">
<a href="http">
<img src="http://lorempixel.com/500/500/cats/8">
</a>
</div>
<div class="thumbs">
<a href="http">
<img src="http://lorempixel.com/500/500/cats/9">
</a>
</div>
<div class="thumbs">
<a href="http">
<img src="http://lorempixel.com/500/500/cats/10">
</a>
</div>
</div>
Removing the <div> tags completely and setting the <img> CLASS (don't use ID's more than once) to thumbs stacks the images nicely next to each other with no margins (thanks to your left float). Unless there's a reason to keep the <div>'s I suggest removing them as they're just in the way, they're also block elements which goes against the inline layout you're after.
I have created three images in a column and I set column-count: 3; plus border-width for those three images. Now I need to know about the hover state.
HTML:
<div class="wrap">
<h1 class="content-title"><span>Popular</span></h1>
<div class="col-3">
<div class="popular">
<a href="#">
<img src="http://s7.postimg.org/bq6aahcpn/Book_ll_4.jpg"/>
</a>
</div>
<div class="caption">
<a href="olymbic.html">
<h2>Saina nehwal first match</h2>
<p>fasdfjaksdksdfh skdfk</p>
</a>
</div>
<div class="popular">
<a href="#">
<img src="http://s7.postimg.org/bq6aahcpn/Book_ll_4.jpg"/>
</a>
</div>
<div class="caption">
<a href="#">
<h2>Saina nehwal first match</h2>
<p>fasdfjaksdksdfh skdfk</p>
</a>
</div>
<div class="popular">
<a href="#">
<img src="http://s7.postimg.org/bq6aahcpn/Book_ll_4.jpg"/>
</a>
</div>
<div class="caption">
<a href="#">
<h2>Saina nehwal first match</h2>
<p>fasdfjaksdksdfh skdfk</p>
</a>
</div>
</div>
</div>
When I hover an image, it needs to look like this:
.
And here is my jsfiddle: http://jsfiddle.net/6g7v899q/
May I know, how to do this?
Thanks in advance.
something like this then ?
img{margin:40px;border:25px solid white;}
img:hover{border-left:25px inset gray;border-right:25px outset gray;border-top:25px outset white;border-bottom:25px inset white;}
<img src="http://lorempixel.com/200/200" width="200" height="200" />
At the bottom of this page http://kimcolemanprojects.com/cyanotype-hats.html there is a section with the title "Related Projects".
I can't move this title down from the grid of images above. I think there must be an error in the Html structure, but I can't find it. I have given the element padding and margin but it still will not move.
This is a section of the html code from that page:
<div class="container">
<div id="header">
<h1>KIM COLEMAN PROJECTS</h1>
<div id="nav">
<ul>
<li id="work">
Work
</li>
<li id="about">
About</li></ul>
</div><!--end nav-->
</div><!--end header-->
<div class="main-individual">
<!-- grid of Work -->
<a rel="hats" href="images/hats/velour 2.jpg" class="fancybox" data-title-id="title-5">
<div class="view view-sixth">
<img src="images/hats/small-velour 2.jpg" />
<div class="mask">
<div class="mask-text">
<h2>Velour trilby with Cyanotype ribbon</h2>
<p></p>
</div>
</div>
</div></a>
<div id="title-5" class="hidden">
Velour trilby with Cyanotype ribbon</div>
<a rel="hats" href="images/hats/balaclava.jpg" class="fancybox" data-title-id="title-1">
<div class="view view-sixth">
<img src="images/hats/small-balaclava.jpg" />
<div class="mask">
<div class="mask-text">
<h2>Balaclava with Cyanotype ribbon</h2>
<p></p>
</div>
</div>
</div></a>
<div id="title-1" class="hidden">
Balaclava with Cyanotype ribbon.
</div>
<span class="similar"><h6>Related Projects</h6></span>
<a href="unique.html" >
<div class="view-small view-sixth-small">
<img src="images/related-project-images/uniques.jpg" />
<div class="mask-small">
<div class="mask-text">
<h2>Unique</h2>
</div>
</div>
</div></a>
<a target="blank" href="http://kimcolemanjennyhogarth.co.uk/glare.htm" >
<div class="view-small view-sixth-small">
<img src="images/related-project-images/glare.png" />
<div class="mask-small">
<div class="mask-text">
<h2>Glare</h2>
</div>
</div>
</div></a>
<a target="blank" href="http://kimcolemanjennyhogarth.co.uk/act_natural.htm" >
<div class="view-small view-sixth-small">
<img src="images/related-project-images/act-natural-glare.png" />
<div class="mask-small">
<div class="mask-text">
<h2>Act Natural Glare</h2>
</div>
</div>
</div></a>
</div>
</div>
You could reduce the margin in the .view-small class, e.g. to margin: 20px 2%. Is this what you meant?
Update: Try to set the line-height: 30px; in .similar class. This moves the title down to the small images.
I am using the plugin Glide.js on my frontpage, and I have build it up almost like shown on the plugin page. This also means that I wish my slider images to have 100% width, but at the same time I want them to be cropped/cut off at the bottom at the window. Precisely like it is don on the plugin page.
My html code looks like this:
<header class='header'>
<div class='header-wrapper'>
<img class='header-logo' src='/assets/glide-logo-cfe0cb95a81b55ff1e872b0c578c527d.png'>
<nav class='header_nav'>
<ul class='header_nav-wrapper'>
<li class='header_nav-item'>
<a class='header_nav-item-a' href='#' id='aboutOpen'>About us</a>
</li>
<li class='header_nav-item'>
<a class='header_nav-item-a' href='#'>Create account</a>
</li>
<li class='header_nav-item'>
<form>
<button class='header_nav-item-a header_nav-item-a--btn header_nav-item-a--donate' src='https://www.paypalobjects.com/en_US/i/btn/'>Login</button>
</form>
</li>
</ul>
</nav>
</img>
</div>
</header>
<div class='slider'>
<div class='slides'>
<div class='slide content_article content_article--fast'>
<center>
<img class='slider-img' src='/assets/bg-fast-219ed63d5978022b88ba2389b4f673b6.jpg'>
<div class='content_article-wrapper'>
<h1 class='content_article-h'>Title 1</h1>
<p class='content_article-p'>
Sub title 1
</p>
<div class='content_article-btns'>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>
<span class='entypo-download'></span>
Read more 1
</a>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>See examples 1</a>
</div>
<img class='content_article-img box-shadow animated fadeOutDownBig' src='/assets/fast-img-3d905c8a57b66ef354467a9a0a07d168.png'>
</div>
</center>
</div>
<div class='slide content_article content_article--simple'>
<center>
<img class='slider-img' src='/assets/bg-responsive-07aefbc31666790f38a6e3e3b46f67a8.jpg'>
<div class='content_article-wrapper'>
<h1 class='content_article-h'>Title 2</h1>
<p class='content_article-p'>
Sub title 2
</p>
<div class='content_article-btns'>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>
<span class='entypo-download'></span>
Read more 2
</a>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>See examples 2</a>
</div>
<img class='content_article-img box-shadow animated fadeOutDownBig' src='/assets/responsive-img-662aaea9b8453dc6eac46064fdcc7a56.png'>
</div>
</center>
</div>
<div class='slide content_article content_article--responsive'>
<center>
<img class='slider-img' src='/assets/bg-simple-2d45eb663c4c69d72f66c19eb0cce285.jpg'>
<div class='content_article-wrapper'>
<h1 class='content_article-h'>Title 3</h1>
<p class='content_article-p'>
Sub title 3
</p>
<div class='content_article-btns'>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>
<span class='entypo-download'></span>
Read more 3
</a>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>See examples 3</a>
</div>
<img class='content_article-img box-shadow animated fadeOutDownBig' src='/assets/simple-img-af275d5091063498174655c95fa41079.png'>
</div>
</center>
</div>
</div>
</div>
My css is very simple, but only handles the 100% width stretch:
.slider-img {
width: 100%;
}
So how do I cut off my slider images so they fit the height of the screen?
Here is the CSS
.crop{
float:left;
margin:.5em 10px .5em 0;
overflow:hidden; /* this is important */
border:1px solid #ccc;
}
/* input values to crop the image */
.crop img{
margin:-20px -15px -40px -55px;
}