Webデザインのこと、いろいろ

Webデザインにまつわることを自分用にメモしています。

レスポンシブ:VOGUEのマネ

全面レイアウト:完成版にリンク
VOGUE JAPAN 15th Anniversary 1999~2014:参考サイト

f:id:sankoblog:20160707223906p:plain

<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>全面レイアウト</title>
<meta name="viewport" content="width=device-width">
<link href="https://fonts.googleapis.com/css?family=Lobster+Two:700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="css/style_y.css">
</head>

<body>
<header>
<p>ここはheader</p>
</header>

<div id="container">
<div class="top topL">
<a href="#">
<div class="cap">
<h3>Snow mountain</h3>
<p class="text">雪山へはリフトでいきましょう</p>
<p class="view">view&nbsp;more</p>
</div></a>
</div>

<div class="top topR">
<a href="#">
<div class="cap">
<h3>Tent</h3>
<p class="text">テントは上手にはりましょう</p>
<p class="view">view&nbsp;more</p>
</div></a>
</div>

<div class="bottom btmL">
<a href="#">
<div class="cap">
<h3>Sea</h3>
<p class="text">カヤックであそぶのもいいですね</p>
<p class="view">view&nbsp;more</p>
</div></a>
</div>

<div class="bottom btmC">
<a href="#">
<div class="cap">
<h3>Mountain</h3>
<p class="text">山に寄り道するのも楽しそうです</p>
<p class="view">view&nbsp;more</p>
</div></a>
</div>

<div class="bottom btmR">
<a href="#">
<div class="cap">
<h3>Coast</h3>
<p class="text">ここは2人組であるきましょう</p>
<p class="view">view&nbsp;more</p>
</div></a>
</div>

<p class="logo"><img src="img/camp.svg" alt="CAMP TRAVEL"></p>

</div><!--#container-->

</body>
</html>
@charset "utf-8";
/* CSS Document */

/* reset */
html, body, div, h1, h2, h3, h4, h5, h6,p, blockquote, pre, 
address,ul, ol, li, dl, dt, dd,table, th, td, form, fieldset {
  margin: 0;
  padding: 0;
  line-height: 1.0;
  font-family:
    "Hiragino Kaku Gothic ProN",
    Meiryo, 
    sans-serif;
}
ul {
  list-style: none; /* マーカーを消す */
}
a {
  text-decoration: none; /* 下線を消す */
}
img {
  border: 0;
  vertical-align: bottom;
}
/*--------------------------*/
html, body {
  width: 100%;
  height: 100%;
}

header {
	width: 20%;
	height: 100%;
	float: left;
	background: #FFF;
	position: fixed;
	z-index: 50;
	background: #98BEC6;
}

#container {
	width: 80%;
	height: 100%;
	float: right;
	position: relative;
}

.top {
  width: 50%;
  height: 50%;
  float: left;
  position: relative;
  overflow: hidden;
}
.bottom {
  width: 33.33%;
  height: 50%;
  float: left;
  position: relative;
  overflow: hidden;
}
.topL {
  background: url(../img/02.png) no-repeat;
  background-size: cover;
}
.topR {
  background: url(../img/01.png) no-repeat 50% 50%;
  background-size: cover;
}
.btmL {
  background: url(../img/03.png) no-repeat;
  background-size: cover;
}
.btmC {
  background: url(../img/04.png) no-repeat;
  background-size: cover;
}
.btmR {
  background: url(../img/05.png) no-repeat;
  background-size: cover;
}
.logo img {
  width: 160px;
  height: 160px;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  z-index: 9999;
}

/*ホバーアクション*/
.top a, bottom a {
  display: block;
  width: 100%;
  height: 100%;
}
.cap {
  padding-top: 240px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  text-align: center;
  z-index: 10;
  opacity: 1;
  transition: .4s ease-in-out;
  background: rgba(245,44,67,0);
  cursor: default;
}
.cap:hover {
  top:-40%;
  left: 0;
  background: rgba(100,100,100,0.7);
}
h3{
  padding-bottom: 20px;
  color: #FFF;
  font-size: 22px;
  font-family: 'Lobster Two', cursive;
}
.text { 
  color: #FFF;
  font-size: 16px;
  padding-bottom: 36px;
}
.view {
  width: 40%;
  margin: 0 auto;
  font-size: 20px;
  color: #FFF;
  padding: 10px;
  border: 1px solid #FFF;
  transition: 0.2s ease-in-out;
}
.view:hover{
  background:white;
  color: #111;
/*  cursor: pointer;*/
}


@media screen and (max-width : 767px){
header {
	width: 100%;
	height: 80px;
	float: none;
	top: 0;
	left: 0;
	z-index: 30;
}
.topL {
	margin-top: 80px;
}
header p {
	text-align: center;
}

#container {
	width: 100%;
	float: none;
}
.top, .bottom {
  float: none;
  width: 100%;
  height: 50%;
  margin-bottom: 180px;/*.capが表示される領域*/
  overflow: inherit; /*overflowを初期値に戻す*/
}
.logo img{
  width: 60px;
  height: 60px;
  padding: 10px;
  position: fixed;
  top:0;
  left:0;
  margin: 0;
}
.top a, bottom a {
  display: block;
  width: 100%;
  height: 180px;
}
.cap {
  padding-top: 0;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 180px;
  transition: none;
  background: rgba(100,100,100,0.7);
}
.cap:hover {
  top: 100%;
  left: 0;
}

h3{
  padding:20px 0;
  color: #FFF;
  font-size: 20px;
}
.text { 
  color: #FFF;
  font-size: 14px;
  padding-left: 10px;
  padding-right: 10px;
  padding-bottom: 20px;
}
}

スマホのタッチアイコンを設定する

タッチアイコンを設定する:完成版にリンク
タッチアイコンの設定方法 - WEBサイト制作の勉強|フェリカテクニカルアカデミー:参考サイト

作成した画像
f:id:sankoblog:20160707222659p:plain
192px × 192px、pngデータ

<!DOCTYPE HTML>
<html lang="ja">

<head>
<meta charset="utf-8">
<title>タッチアイコンを設定する</title>
<meta name="apple-mobile-web-app-title" content="testtest">
<link rel="stylesheet" href="css/style.css">

<!-- iOS Safari and Chrome -->
<link rel="apple-touch-icon" sizes="192x192" href="touch_icon01.png">

<!-- Android標準ブラウザ(一部) -->
<link rel="shortcut icon" href="touch_icon01.png">
</head>

<body>
</body>
</html>

100vh:ヒーローヘッダー

ヒーローヘッダー:完成版にリンク
height:100vh という単位

f:id:sankoblog:20160707222317p:plain

<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>ヒーローヘッダー</title>
<style>
html,body,h1,p {
	margin: 0;
	padding: 0;
}
#box1 {
	background: url(img/hato.JPG) no-repeat;
	width: 100%;
	height: 100vh;
	background-size: cover;
}
#box2 {
	background: url(img/rain.jpg) no-repeat;
	width: 100%;
	height: 100vh;
	background-size: cover;
}
p {
	color: #FFF;
	font-size: 3rem;
	text-align: center;
	font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, Osaka, "MS Pゴシック", "MS PGothic", sans-serif;
}

@media screen and (max-width:767px) {
	#box1 {
		height: 30vh;
	}
	#box2 {
		height: 70h;
	}
}
</style>
</head>

<body>
<div id="box1"><p>きょうの鳩だより</p></div>
<div id="box2"><p>雨の日はお休みです</p></div>
</body>
</html>

Twitterのウィジェットをつくる

twitter のプラグイン:完成版にリンク
埋め込みタイムライン | Twitter Developers:参考サイト
Login on Twitter:参考サイト

f:id:sankoblog:20160707221809p:plain

<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>twitter のプラグイン</title>
<style>
#twitter {
	width: 30%;
}
</style>
</head>

<body>
<div id="twitter">
<a class="twitter-timeline" href="https://twitter.com/fubiz" data-widget-id="724889102533939200">@fubizさんのツイート</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>

<div id="facebook">
</div>
</body>
</html>

jQuery:プラグイン:MixItUp:フィルタリング

フィルタリング:MixItUp:完成版にリンク
MixItUp:参考サイト

f:id:sankoblog:20160707220748p:plain

<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>フィルタリング:MixItUp</title>
<link rel="stylesheet" href="css/mixitup.css">
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://cdn.jsdelivr.net/jquery.mixitup/latest/jquery.mixitup.min.js"></script>
<script>
    // On document ready:
$(function(){
	// Instantiate MixItUp:
	$('#Container').mixItUp();
});
</script>
</head>

<body>
<div id="wrapper">
<h1>MixItUpを使ったデモページ</h1>
<div class="controls">  <!--ナビといっしょ-->
  <label>カテゴリー:</label>
  <button class="filter" data-filter="all">全部</button>
  <button class="filter" data-filter=".red">赤いもの</button>
  <button class="filter" data-filter=".yellow">黄色いもの</button>
  <button class="filter" data-filter=".blue">青いもの</button>
  <button class="filter" data-filter=".human">ひと</button>
  <button class="filter" data-filter=".cat">ねこ</button>
  <button class="filter" data-filter=".wani">わに</button>
  <button class="filter" data-filter=".apple">りんご</button>
  <label>Sort:</label>
  <button class="sort" data-sort="myorder:asc">番号の小さい順</button>
  <button class="sort" data-sort="myorder:desc">番号の大きい順</button>
</div>

<div id="Container" class="container"> <!--大文字と小文字の使い分け-->
  <!--mix は必ずいれる-->
  <div class="mix red cat" data-myorder="1"><a href="#"><img src="img/r_c.png" alt="#"></a></div>
  <div class="mix red human" data-myorder="2"><a href="#"><img src="img/r_h.png" alt="#"></a></div>
  <div class="mix red wani" data-myorder="3"><a href="#"><img src="img/r_w.png" alt="#"></a></div>
  <div class="mix red apple" data-myorder="4"><a href="#"><img src="img/r_a.png" alt="#"></a></div>
  <div class="mix yellow wani" data-myorder="9"><a href="#"><img src="img/y_w.png" alt="#"></a></div>
  <div class="mix yellow cat" data-myorder="10"><a href="#"><img src="img/y_c.png" alt="#"></a></div>
  <div class="mix yellow apple" data-myorder="11"><a href="#"><img src="img/y_a.png" alt="#"></a></div>
  <div class="mix yellow human" data-myorder="12"><a href="#"><img src="img/y_h.png" alt="#"></a></div>
  <div class="mix blue apple" data-myorder="5"><a href="#"><img src="img/b_a.png" alt="#"></a></div>
  <div class="mix blue human" data-myorder="6"><a href="#"><img src="img/b_h.png" alt="#"></a></div>
  <div class="mix blue cat" data-myorder="7"><a href="#"><img src="img/b_c.png" alt="#"></a></div>
  <div class="mix blue wani" data-myorder="8"><a href="#"><img src="img/b_w.png" alt="#"></a></div>
  </div><!--#Container-->
  
<div class="gap"></div>
<div class="gap"></div>
</div><!--#wrapper-->
</body>
</html>
@charset "utf-8";
/* CSS Document */

/* reset */
html, body, div, h1, h2, h3, h4, h5, h6,p, blockquote, pre, 
address,ul, ol, li, dl, dt, dd,table, th, td, form, fieldset {
  margin: 0;
  padding: 0;
  line-height: 1.0;
  font-family:
    "Hiragino Kaku Gothic ProN",
    Meiryo, 
    sans-serif;
  box-sizing: border-box;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}
ul, ol {
  list-style: none; /* マーカーを消す */
}
a {
  text-decoration: none; /* 下線を消す */
}
img {
  border: 0;
  vertical-align: bottom;
}

/*body {
	overflow-y: scroll;
}*/
.controls{
  padding: 2%;
  background: #333;
  color: #eee;
}

label{
  font-weight: 300;
  margin: 0 .4em 0 0;
}

button{
  display: inline-block;
  padding: .4em .8em;
  background: #666;
  border: 0;
  color: #ddd;
  font-size: 16px;
  font-weight: 300;
  border-radius: 4px;
  cursor: pointer;
}

button.active{
  background: #68b8c4;
}

button:focus{
  outline: 0 none;
}

button + label{
  margin-left: 1em;
}

.container{
  padding: 2% 2% 0;
  text-align: justify;
  font-size: 0.1px;
  background: #68b8c4;
  -webkit-backface-visibility: hidden;
}

.container:after{
  content: '';
  display: inline-block;
  width: 100%;
}

.container .mix,
.container .gap{
  display: inline-block;
  width: 49%;
}

.container .mix{
  background: transpearent;
  margin-bottom: 2%;
  display: none;
}

.container .mix:after{
 /* content: attr(data-myorder);*/
  color: white;
  font-size: 16px;
  display: inline-block;
  vertical-align: top;
  /*padding: 4% 0 6% 0;*/
  font-weight: 700;
}

.container .mix:before{
  content: '';
  display: inline-block;
  padding-top: 60%;
}
img {
  max-width: 100%;
}
@media all and (min-width: 420px){  /*モバイルファースト*/
  .container .mix,
  .container .gap{
    width: 32%;
  }
}

@media all and (min-width: 640px){
/*モバイルファーストなので、PCのレイアウトを変えたいときはこちらから*/
/*海外のプラグインはこのような設定になっていることがあるので注意*/
  .container .mix,
  .container .gap{
    width: 24%;
  }
}

jQuery:プラグイン:Slick

slickの使い方:完成版にリンク
レスポンシブに強いカルーセルスライダーslickの使い方|Gimmick log:参考サイト

f:id:sankoblog:20160707215515p:plain

<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>slickの使い方</title>
<link rel="stylesheet" href="css/slick.css">
<link rel="stylesheet" href="css/slick-theme.css">
<script src="js/jquery-2.2.1.min.js"></script>
<script src="js/slick.min.js"></script>
<script>
$(function(){
$('.sample').slick({
autoplay:true,
autoplaySpeed:2000,
dots:true,
pauseOnHover:true
});
}); 
</script>
<script>
$(function(){
	$('.single-item').slick();
  });
</script>
</head>

<body>
<ul class="sample">
<li><img src="img/01.png"></li>
<li><img src="img/02.png"></li>
<li><img src="img/03.png"></li>
</ul>
</body>
</html>

jQuery:プラグイン:LightBox

LightBox+カルーセルパネル:完成版にリンク

f:id:sankoblog:20160707214931p:plain

<!DOCTYPE HTML>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>LightBox+カルーセルパネル</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/scrollable-horizontal.css" >
<link rel="stylesheet" href="css/lightbox.css" >
<script src="js/jquery.tools.min.js"></script>
<script src="js/lightbox.js"></script>
</head>

<body> 
<a class="prev browse left"></a> 
<div class="scrollable">
<div class="items">
<div> 
<a href="img/1_t.jpg" title="Charles Chaplin"><img src="img/1.jpg"></a>
<a href="img/2_t.jpg" title="The Beatles"><img src="img/2.jpg"></a> 
<a href="img/3_t.jpg" title="James Brown"><img src="img/3.jpg"></a> 
<a href="img/4_t.jpg" title="Bob Dylan"><img src="img/4.jpg"></a> 
<a href="img/5_t.jpg" title="Neil Young"><img src="img/5.jpg"></a> 
</div> 
<div> 
<a href="img/6_t.jpg" title="Pablo Picasso"><img src="img/6.jpg"></a> 
<a href="img/7_t.jpg" title="Marc Chagall"><img src="img/7.jpg"></a> 
<a href="img/8_t.jpg" title="Erik Satie"><img src="img/8.jpg"></a> 
<a href="img/9_t.jpg" title="Andy Warhol"><img src="img/9.jpg"></a> 
<a href="img/10_t.jpg" title="Salvador Dali"><img src="img/10.jpg"></a> 
</div> 
<div> 
<a href="img/11_t.jpg" title="Albert Einstein"><img src="img/11.jpg"></a> 
<a href="img/12_t.jpg" title="勝海舟"><img src="img/12.jpg"></a> 
<a href="img/13_t.jpg" title="Martin Luther King"><img src="img/13.jpg"></a> 
<a href="img/14_t.jpg" title="Malcolm X"><img src="img/14.jpg"></a> 
<a href="img/15_t.jpg" title="Mohandas Gandhi"><img src="img/15.jpg"></a> 
</div> 
</div>   
</div> 
<a class="next browse right"></a>
<script>
$(function() {
  $(".scrollable").scrollable();
});
</script>
</body> 
</html>
@charset "UTF-8";

html, body, div {
  margin:0;
  padding:0;
}
body {
  font-size:1em;
  font-family:
    "Hiragino Kaku Gothic ProN",
    Meiryo, 
    sans-serif;
  margin: 0px;
  padding:50px 80px;
  }
/* this makes it possible to add next button beside scrollable */
.scrollable {
  float:left;  
}
/* prev, next, prevPage and nextPage buttons */
a.browse {
  background:url(../img/hori_large.png) no-repeat;
  display:block;
  width:30px;
  height:30px;
  float:left;
  margin:40px 10px;
  cursor:pointer;
  font-size:1px;
}
/* right */
a.right { background-position: 0 -30px; clear:right; margin-right: 0px;}
a.right:hover { background-position:-30px -30px; }
a.right:active { background-position:-60px -30px; } 
/* left */
a.left { margin-left: 0px; } 
a.left:hover { background-position:-30px 0; }
a.left:active { background-position:-60px 0; }
/* disabled navigational button */
a.disabled {
  visibility:hidden !important;    
}