WEBデザインの勉強

WEB制作初心者が1から勉強するブログ。

立体的なテキスト

f:id:mmmmofu:20170614011052p:plain

デモ
http://efu.sakura.ne.jp/web/text/

<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <title>テキスト</title>
  <link rel="stylesheet" href="http://efu.sakura.ne.jp/web/common/css/reset.css">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Sorts+Mill+Goudy">
  <link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700,900" rel="stylesheet">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <h1>Three-dimensional</h1>
  <div class="textwrap">
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
  </div>
</body>
</html>
@charset "utf-8";

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  position: relative;
  font-family: 'Roboto', sans-serif;
}

h1 {
  color: #FFF;
  position: absolute;
  top: 220px;
  left: 100px;
  color: rgba(0,0,0,0);

  -webkit-transform: skew(63deg,-26.6deg);
  -moz-transform: skew(63deg,-26.6deg);
  -o-transform: skew(63deg,-26.6deg);
  -ms-transform: skew(63deg,-26.6deg);
  transform: skew(63deg,-26.6deg);
  text-shadow: 0 0 3px rgba(70, 10, 30, 0.25);
  z-index: 50;
  font-size: 80px;
  white-space: nowrap;
  font-weight: 700;
}

h1:after {
  content: "Three-dimensional";
  position: absolute;
  top: 15px;
  left: 25px;
  color: rgba(255,255,255,1);
  -webkit-transform: skew(-63deg) scale(1,.5);
  -moz-transform: skew(-63deg) scale(1,.5);
  -o-transform: skew(-63deg) scale(1,.5);
  -ms-transform: skew(-63deg) scale(1,.5);
  transform: skew(-63deg) scale(1,.5);
  text-shadow: -1px -1px 1px #aaa, -2px -2px 1px #999, -3px -3px 1px #888, -4px -4px 1px #777, -5px -5px 1px #666, -6px -6px 1px #555, -7px -7px 5px rgba(0, 0, 128, 0.75);
  z-index: 100;
}

.textwrap {
  width: 700px;
  position: absolute;
  top: 300px;
  left: 390px;
  text-align: center;
  -webkit-transform: skew(63deg,-26.6deg);
  -moz-transform: skew(63deg,-26.6deg);
  -o-transform: skew(63deg,-26.6deg);
  -ms-transform: skew(63deg,-26.6deg);
  transform: skew(63deg,-26.6deg);
  font-size: 0;
}

.textwrap p {
  width: 300px;
  display: inline-block;
  font-size: 12px;
  text-align: left;
  color: #222;
  letter-spacing: 0.1em;
  font-family: 'Sorts Mill Goudy', serif;
}

.textwrap p:first-child {
  margin-right: 50px;
}

参考
codepen.io