[パーツ]記事一覧などに使うニュースカード コンパクトなニュースカード

CSS HTML
 2018.06.26

コンパクトなニュースカード

ホバーで画像が大きくなり、タグ要素と投稿日が表示されます。

browser:  65 11 20 10 
ニャン易度 

記事タイトル

サブタイトルなど

吾輩は猫である。名前はまだ無い。どこで生れたかとんと見当がつかぬ。何でも薄暗いじめじめした所で...

Read More
<div class="cp_card02">
	<div class="photo photo1"></div>
	<ul class="details">
		<li class="author"><a href="#">copypet</a></li>
		<li class="date">2018.06.21</li>
		<li class="tags">
			<ul>
				<li><a href="#">css</a></li>
				<li><a href="#">html</a></li>
			</ul>
		</li>
	</ul>
	<div class="description">
		<h1>記事タイトル</h1>
		<h2>サブタイトルなど</h2>
		<p class="text">吾輩は猫である。名前はまだ無い。どこで生れたかとんと見当がつかぬ。何でも薄暗いじめじめした所で...</p>
		<a href="#">Read More</a>
	</div>
</div>
.cp_card02 {
	font-size: 14px;
	line-height: 1.45em;
	position: relative;
	overflow: hidden;
	height: 200px;
	margin: 0 auto 1.6%;
	-webkit-transition: height 0.3s ease;
	        transition: height 0.3s ease;
	border-radius: 3px;
	background: #ffffff;
	-webkit-box-shadow: 0 3px 7px -3px rgba(0, 0, 0, 0.3);
	        box-shadow: 0 3px 7px -3px rgba(0, 0, 0, 0.3);
}
.cp_card02:hover .details {
	left: 0;
}
.cp_card02:hover.alt .details {
	right: 0;
}
.cp_card02.alt .details {
	right: -100%;
	left: inherit;
}
.cp_card02 .photo {
	position: relative;
	float: left;
	width: 40%;
	height: 100%;
	-webkit-transition: all 0.5s ease;
	        transition: all 0.5s ease;
}
.cp_card02:hover .photo {
	-webkit-transform: rotate(5deg) scale(1.3);
	        transform: rotate(5deg) scale(1.3);
}
.cp_card02 .photo.photo1 {
	background: url('images.jpg') center no-repeat;
	background-size: cover;
}
.cp_card02 .details {
	position: absolute;
	top: 0;
	left: -100%;
	width: 40%;
	height: 200px;
	margin: 0;
	padding: 10px 15px;
	list-style: none;
	-webkit-transition: all 0.3s ease;
	        transition: all 0.3s ease;
	color: #ffffff;
	background: rgba(255,87,34, 0.4);
}
.cp_card02 .details > li {
	padding: 3px 0;
}
.cp_card02 .details li::before,
.cp_card02 .details .tags ul::before {
	font-family: FontAwesome;
	margin-right: 10px;
	vertical-align: middle;
}
.cp_card02 .details .author::before {
	content: '\f007';
}
.cp_card02 .details .date::before {
	content: '\f133';
}
.cp_card02 .details .tags ul {
	margin: 0;
	padding: 0;
	list-style: none;
}
.cp_card02 .details .tags ul::before {
	content: '\f02b';
}
.cp_card02 .details .tags li {
	display: inline-block;
	margin-right: 3px;
}
.cp_card02 .details a {
	color: inherit;
}
.cp_card02 .details a:hover {
	color: #ff5722;
}
.cp_card02 .description {
	position: relative;
	z-index: 0;
	float: left;
	width: 60%;
	padding: 10px;
	min-height: 200px;
}
.cp_card02 .description::before {
	position: absolute;
	z-index: -1;
	top: 0;
	bottom: 0;
	left: -15px;
	width: 100%;
	content: '';
	-webkit-transform: skewX(-8deg);
	        transform: skewX(-8deg);
	background: #ffffff;
}
.cp_card02 .description h1 {
	font-size: 1.4em;
	line-height: 1em;
	margin: 0 0 10px 0;
}
.cp_card02 .description h2 {
	font-size: 1em;
	line-height: 1.2em;
	margin: 1.2% 0;
	color: #9b9b9b;
}
.cp_card02 .description p {
	position: relative;
	margin: 0;
	padding-top: 20px;
}
.cp_card02 .description p::after {
	position: absolute;
	top: 6px;
	left: 0;
	width: 20%;
	height: 6px;
	content: '';
	background: #ff5722;
}
.cp_card02 .description a {
	float: right;
	margin-bottom: 10px;
	text-decoration: none;
	color: #ff5722;
}
.cp_card02 .description a::after {
	font-family: FontAwesome;
	margin-left: -10px;
	content: '\f061';
	-webkit-transition: all 0.3s ease;
	        transition: all 0.3s ease;
	vertical-align: middle;
	opacity: 0;
}
.cp_card02 .description a:hover::after {
	margin-left: 5px;
	opacity: 1;
}
@media screen and (max-width: 480px) {
	.cp_card02 .description h1 {
		font-size: 1.3em;
	}
}

copypet.jp

CSS3などで新たに追加された要素・装飾方法など、日々コードを書いていないと忘れてしまったり、ささっとプロトタイプを作る時などちょっとしたことに時間をかけている暇はない。そんな時に「あ〜、あれストックしときゃよかったなぁ」って困った自分用のストックブログです。カスタマイズなどがしやすいよう、昨今のweb制作に取り入れられる一般的なコードを中心に掲載しています。

More Info

こんな記事はいかがですか?