OS X Window Pure CSS Mockup!

OS X Yosemite から採用された、シンプルなクローズボタンのウインドウのピュアCSS模型

このモックアップは、ドイツ人のヨハネス・ジェイコブさんが作ったもので、コードペンにて公開しているものを、私がアレンジしたものです。

©2015 Johannes Jakob Codepen

Yosemite Window

x
+
CSS OS X Yosemite Window

Hey! What’s up?

I’m a simple OS X Yosemite style window.

https://codepen.io/JohJakob/pen/YPxgwo

<!-- ©2015 Johannes Jakob
     Made with <3 in Germany -->

<div class="yosemite window">
  <div class="titlebar">
    <div class="buttons">
      <div class="close">
        <a class="closebutton" href="#"><span><strong>x</strong></span></a>
        <!-- close button link -->
      </div>
      <div class="minimize">
        <a class="minimizebutton" href="#"><span><strong>–</strong></span></a>
        <!-- minimize button link -->
      </div>
      <div class="zoom">
        <a class="zoombutton" href="#"><span><strong>+</strong></span></a>
        <!-- zoom button link -->
      </div>
    </div>
    CSS OS X Yosemite Window
    <!-- window title -->
  </div>
  <div class="content">
    <h3>Hey! What's up?</h3>
    <p>I'm a simple OS X Yosemite style window.</p>
    <p><a href="https://codepen.io/JohJakob/pen/YPxgwo" target="_blank" rel="noopener noreferrer">https://codepen.io/JohJakob/pen/YPxgwo</a></p>
    <!-- window content -->
  </div>
</div>
.window {
    max-width: calc(700px - 30px);
    background: #fff;
    width: 100%;
    margin: auto;
    border-radius: 10px;
    padding: 0;
    box-shadow: 5px 5px 40px #0000007a;
}

.titlebar {
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0.0, #ebebeb, color-stop(1.0, #d5d5d5)));
  background: -webkit-linear-gradient(top, #ebebeb, #d5d5d5);
  background: -moz-linear-gradient(top, #ebebeb, #d5d5d5);
  background: -ms-linear-gradient(top, #ebebeb, #d5d5d5);
  background: -o-linear-gradient(top, #ebebeb, #d5d5d5);
  background: linear-gradient(top, #ebebeb, #d5d5d5);
  color: #4d494d;
  font-size: 12pt;
  line-height: 27px;
  text-align: center;
  width: 100%;
  height: 30px;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -o-user-select: none;
  cursor: default;
}

.buttons {
  padding-left: 8px;
  padding-top: 8px;
  float: left;
  line-height: 0px;
}

.buttons:hover a {
  visibility: visible;
}

.close {
  background: #ff5c5c;
  font-size: 9pt;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
}

.close:active {
  background: #c14645;
  border: 1px solid #b03537;
}

.close:active .closebutton {
  color: #4e0002;
}

.closebutton {
  color: #820005;
  visibility: hidden;
  cursor: default;
}

.minimize {
  background: #ffbd4c;
  font-size: 9pt;
  line-height: 11px;
  margin-left: 4px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
}

.minimize:active {
  background: #c08e38;
  border: 1px solid #af7c33;
}

.minimize:active .minimizebutton {
  color: #5a2607;
}

.minimizebutton {
  color: #9a5518;
  visibility: hidden;
  cursor: default;
}

.zoom {
  background: #00ca56;
  font-size: 9pt;
  line-height: 11px;
  margin-left: 6px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
}

.zoom:active {
  background: #029740;
  border: 1px solid #128435;
}

.zoom:active .zoombutton {
  color: #003107;
}

.zoombutton {
  color: #006519;
  visibility: hidden;
  cursor: default;
}

.content {
  padding: 0 1em 2em;
  color: #000;
}

.content a {
  color: blue;
}

.content a:hover {
  text-decoration: underline !important;
}

h3 {
  margin-top: 0px;
}

@media (max-width: 425px) {
  .window {
    width: 94%; 
}
}

Dark Mode Window

x
+
CSS OS X Dark Mode Window

Hey! What’s up?

I’m a simple OS X Dark Mode style window.

https://codepen.io/JohJakob/pen/YPxgwo

<!-- ©2015 Johannes Jakob
     Made with <3 in Germany -->

<div class="dark window">
  <div class="titlebar">
    <div class="buttons">
      <div class="close">
        <a class="closebutton" href="#"><span><strong>x</strong></span></a>
        <!-- close button link -->
      </div>
      <div class="minimize">
        <a class="minimizebutton" href="#"><span><strong>–</strong></span></a>
        <!-- minimize button link -->
      </div>
      <div class="zoom">
        <a class="zoombutton" href="#"><span><strong>+</strong></span></a>
        <!-- zoom button link -->
      </div>
    </div>
    CSS OS X Dark Mode Window
    <!-- window title -->
  </div>
  <div class="content">
    <h3>Hey! What's up?</h3>
    <p>I'm a simple OS X Dark Mode style window.</p>
    <p><a href="https://codepen.io/JohJakob/pen/YPxgwo" target="_blank" rel="noopener noreferrer">https://codepen.io/JohJakob/pen/YPxgwo</a></p>
    <!-- window content -->
  </div>
</div>
.dark.window {
  max-width: calc(700px - 30px); /* ウィンドウの幅を指定 */
  background: #1d1d1d;
  width: 100%;
  margin: auto;
  border-radius: 10px;
  padding: 0;
  box-shadow: 5px 5px 40px #0000007a;
}

.dark .titlebar {
  background: #333;
  color: #dcdcdc;
  font-size: 12pt;
  line-height: 27px;
  text-align: center;
  width: 100%;
  height: 30px;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -o-user-select: none;
  cursor: default;
}

.buttons {
  padding-left: 8px;
  padding-top: 8px;
  float: left;
  line-height: 0px;
}

.buttons:hover a {
  visibility: visible;
}

.close {
  background: #ff5c5c;
  font-size: 9pt;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
}

.close:active {
  background: #c14645;
  border: 1px solid #b03537;
}

.close:active .closebutton {
  color: #4e0002;
}

.closebutton {
  color: #820005;
  visibility: hidden;
  cursor: default;
}

.minimize {
  background: #ffbd4c;
  font-size: 9pt;
  line-height: 11px;
  margin-left: 4px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
}

.minimize:active {
  background: #c08e38;
  border: 1px solid #af7c33;
}

.minimize:active .minimizebutton {
  color: #5a2607;
}

.minimizebutton {
  color: #9a5518;
  visibility: hidden;
  cursor: default;
}

.zoom {
  background: #00ca56;
  font-size: 9pt;
  line-height: 11px;
  margin-left: 6px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
}

.zoom:active {
  background: #029740;
  border: 1px solid #128435;
}

.zoom:active .zoombutton {
  color: #003107;
}

.zoombutton {
  color: #006519;
  visibility: hidden;
  cursor: default;
}

.dark .content {
  padding: 0 1em 2em;
  color: #dcdcdc;
}

.dark .content a {
  color: #04cff5;
}

.content a:hover {
  text-decoration: underline !important;
}

h3 {
  margin-top: 0px;
}

@media (max-width: 425px) {
  .window {
    width: 94%; 
}
}
</style>

Leave a Comment

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です