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

              
                <main class='card'>
  <!--   左邊欄位:圖片 -->
  <section class='avatar-container'>
    <!-- 放置圖片 -->
    <div class="avatar"></div>
    <div class="avatar-overlay">
      <div class="overlay-title">Tony Stark</div>
    </div>
  </section>
  <!-- 右邊欄位:人名、描述 -->
  <section class="info">
    <div class="info-container">
      <h1 class="name">Robert Downey Jr.</h1>
      <h2 class="hero">Iron Man</h2>
      <p class="description">Robert John Downey Jr. is an American actor. His career has included critical and popular success in his youth, followed by a period of substance abuse and legal difficulties, and a resurgence of commercial success in middle age.</p>
      <div class="social-media">
        <div class="button">
          <div class="icon"><i class="fa-brands fa-facebook fa-lg"></i></div>
          <span>Facebook</span>
        </div>
        <div class="button">
          <div class="icon"><i class="fa-brands fa-x-twitter fa-lg"></i></div>
          <span>X (Twitter)</span>
        </div>
        <div class="button">
          <div class="icon"><i class="fa-brands fa-instagram fa-lg"></i></div>
          <span>Instagram</span>
        </div>     
      </div>
    </div>
  </section>
</main>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,700);

html,
body {
  font-family: "Open Sans", sans-serif;
}

.card {
  height: 550px;
  display: flex;
  border: 1px solid #CAC2B5;
  border-radius: 1%;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 0 10px rgba(0, 0, 0, 0.22);
  background: #F2EDEB;
}

.avatar-container {
  width: 50%;
  height: 100%;
  position: relative;
}
.avatar {
  width: 100%;
  height: 100%;
  background: url("https://static1.squarespace.com/static/51b3dc8ee4b051b96ceb10de/t/595a6198bebafb3c5c811730/1499095469215/?format=2500w");
  background-size: cover;
  background-position: top;
}
.avatar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.7s;
}
.avatar-overlay:hover {
  opacity: 1;
}
.overlay-title {
  font-size: 2em;
  font-weight: bold;
  transform: translateY(20px);
  transition: transform 0.25s;
}
.avatar-overlay:hover > * {
  transform: translateY(0);
}

/* 右邊欄位:人名、描述 */
.info {
  width: 50%;
}
.info-container {
  padding: 40px;
}
.name {
  font-size: 2.5rem;
  color: #001B2E;
  margin-bottom: 0;
}
.hero {
  font-size: 1.8rem;
  color: #BC2C1A;
  margin-top: 0;
  margin-bottom: 0;
}
.description {
  font-size: 1rem;
  font-style: italic;
  color: #2A2B2A;
  margin-top: 5px;
  border-top: 2px solid #CAC2B5;
  padding-top: 18px;
}
.social-media .button {    
  display: inline-block;
  float: left;
  width: 60px;
  height: 60px;
  margin: 0 5px;
  overflow: hidden;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease-out;
}
.social-media .button:hover {
  width: 200px;
}
.social-media .button .icon {
  display: inline-block;
  border-radius: 50px;
  width: 60px;
  height: 60px;
  border-radius: 50px;
  line-height: 60px;
  text-align: center;
  transition: all 0.3s ease-out;
}
.social-media .button:nth-child(1):hover .icon {
  background: #4267B2;
}
.social-media .button:nth-child(2):hover .icon {
  background: #3E505B;
}
.social-media .button:nth-child(3):hover .icon {
  background: #E1306D;
}
.social-media .button .icon i {
  font-size: 35px;
  line-height: 60px;
}
.social-media .button:hover .icon i {
  color: #fff;  
}
.social-media .button span {
  font-size: 20px;
  font-weight: bold;
  line-height: 60px;
  margin-left: 10px;
  transition: all 0.3s ease-out;
}
.social-media .button:nth-child(1) span {
  color: #4267B2;
}
.social-media .button:nth-child(2) span {
  color: #3E505B;
}
.social-media .button:nth-child(3) span {
  color: #E1306D;
}
              
            
!

JS

              
                
              
            
!
999px

Console