Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <head>
  <meta name="robots" content="noindex,nofollow">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <!--==============レイアウトを制御する独自のCSSを読み込み===============-->
  <link rel="stylesheet" type="text/css" href="https://dl.dropbox.com/s/saz7ehm66llopzw/reset.css?dl=0">
  <!--==============FontAwesomeを読み込み===============-->
  <link href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" rel="stylesheet">
</head>

<body>

  <p class="lead">マウスポインタをメニューの上に持ってきて</p>
  <ul class="gnavi">
    <li class="current"><a href="#"><span>Home</span><span><i class="fas fa-home"></i> ホーム</span></a></li>
    <li><a href="https://web-navigator.com/"><span>About</span><span><i class="fas fa-users"></i> WEB先案内</span></a></li>
    <li><a href="#"><span>Service</span><span><i class="fas fa-hand-holding-heart"></i> サービス</span></a></li>
    <li><a href="#"><span>Contact</span><span><i class="fas fa-headset"></i> お問い合わせ</span></a></li>
  </ul>

</body>
              
            
!

CSS

              
                @charset "utf-8";

/*==================================================
共通 横並びのための設定
===================================*/

.gnavi {
  display: flex;
  flex-wrap: wrap; /*スマホ表示折り返し用なのでPCのみなら不要*/
  margin: 0 0 50px 0;
  list-style: none;
}

.gnavi li a {
  display: block;
  text-decoration: none;
  color: #333;
}

.gnavi li {
  margin-bottom: 20px;
}

/*==================================================
 テキストが入れ替わる
===================================*/

.gnavi li a {
  /*テキストの基点とするためrelativeを指定*/
  position: relative;
  /*はみ出る要素を隠す*/
  overflow: hidden;
  padding: 10px 60px;
}

.gnavi li span {
  /*絶対配置でテキストの位置を決める*/
  position: absolute;
  left: 50%;
  top: 0;
  /*アニメーションの指定*/
  transition: all 0.5s;
  transform: translate(-50%, 0); /*X方向に-50% ※中央寄せにするため*/
  /*ブロック要素にして透過なし、テキスト折り返しなし*/
  display: block;
  opacity: 1;
  white-space: nowrap;
}

/*差し替わるテキストの設定*/
.gnavi li span:nth-child(2) {
  opacity: 0; /*透過0に*/
  transform: translate(-50%, 100%); /*X方向に-50% Y方向に100%*/
}

/*hoverするとテキストが入れ替わる設定*/
.gnavi li:hover span:nth-child(1) {
  opacity: 0; /*透過0に*/
  transform: translate(-50%, -100%); /*X方向に-50% Y方向に-100%*/
}

.gnavi li:hover span:nth-child(2) {
  opacity: 1; /*不透明に*/
  color: rgba(249, 143, 253, 1);
  transform: translate(-50%, 0); /*X方向に-50% Y方向に0*/
}

/*========= レイアウトのためのCSS ===============*/

.lead {
  padding: 30px 20px;
}

              
            
!

JS

              
                
              
            
!
999px

Console