123

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="container">  

      <article class="col oneline">
        <div class="circle-in"><p>only one line</p></div>
      </article>
      <article class="col">
        <div class="spacer"></div>
        <div class="circle"><h1><a href="#">Try resizing the window to see grow and shrink the circles</a></h1> </div>
      </article>
      <article class="col">
        <div class="spacer"></div>
        <div class="circle"><div class="wrapcontent"><h1><a href="#">This is an h1 text.</a></h1><p>And this is a paragraph text</p>
          </div>
        </div>
      </article>
      <article class="col">
        <div class="spacer"></div>
        <div class="circle"><div class="wrapcontent"
          <h1><a href="#">This is a long h1 text in more than two lines, maybe there are four.</a></h1></div> </div>
      </article>
      <article class="col">
        <div class="spacer"></div>
       <div class="outline"> <div class="circle">
          <h1><a href="#">Without wrapcontent. Only works in big resolutions</a></h1> </div></div>
      </article>
   <article class="col">
        <div class="spacer"></div>
        <div class="circle"> 
          <h1><a href="#">This text is out of the circle because there is space between .circle and child element in html</a></h1>
          </div>
      </article>
</div>
            
          
!
            
              @import "compass/css3";

* {
	-webkit-box-sizing: border-box;
	-moz-box-sizing:    border-box;
	box-sizing:         border-box;
}
body {
  font-size: 16px;
  font-family: Helvetica, Arial, Sans-Serif;
    background-color: #ddd;
}
a {text-decoration: none;}
.container {
  width:98%;
  height: 100%;
  margin: 0 auto;

  display: block;  
}

.col {
   width: 100%;
   padding:5%;
   background-color: red;
  margin-bottom: 5%;
  border-top: 5px solid red;
}
.h1, p {
    color: #333;
    text-align: left;
}
  h1 {
    font-size: 1em;
    line-height: 1em;
  }
  p {
    font-size: 1em;
    line-height: 1em;
    color:white;
  }
  a {
    color: inherit;
    &:hover {
     color: white; 
    }
  }  

/* the blue circle with only one line of text, centered vertically */
.oneline {
  &:after {
    content: "";
    display: block;
    width: 100%;
    height:0;
    padding-bottom: 100%;
    background: cadetblue;
    -moz-border-radius: 50%;
    -webkit-border-radius: 50%;
    border-radius: 50%;
  }
  &:hover:after {
    background-color: goldenrod;
  }
 div {
    float:left;
    width:100%;
    padding-top:50%;
    line-height:1em;
    margin-top:-1.7em;
    text-align:center;
    color:white;
 }
  p {text-align: center; font-size: 1.2em;}
}


@media only screen and (min-width: 350px) {

.col {
   display: inline-block;
   position: relative;
   width: 30%;
   margin:4% 0 5% 3%;
   padding:0;
   background-color: transparent;
    border-top: none;
  .spacer {
    position: relative;
    padding-top: 100%;
   }
  &:nth-child(3n+1) {
	   margin-left: 1%;
	   }
  
}
.circle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: powderblue;
    color: #333;
    border-radius: 50%;
    box-sizing: border-box;
    text-align: center;
    display: block;
  padding: 5px;
    &:before {
      content: '';
      display: inline-block;
      height: 100%;
      vertical-align: middle;
      margin-right: -2%;
     }
      border: 5px solid darken(powderblue, 5%);
      -webkit-transition: all 1s ease-out;
      -moz-transition: all 1s ease-out;
      -o-transition: all 1s ease-out;
      transition: all 1s ease-out;
     &:hover {
       background-color: maroon;
       border: 5px solid darken(maroon, 10%);
       color: #fff;
       }
 }
 

  .outline {
    border: 5px solid grey;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 50%;
    box-sizing: border-box;
  }
  
.circle {
  h1 {
    font-size: 0.9em;
    line-height: 1em;

  }
  p {
    font-size: 0.8em;
    line-height: 1em;
    color:white;
    text-align: center;
  }
  a {
    color: inherit;
  }
  &>p, &>h1, &>.wrapcontent {
    display: inline-block;
    vertical-align: middle;
    &>p, &>h1 {
      display:block;
    }
  }
}


}
@media only screen and (min-width: 481px) {
.circle {
  h1 {
    font-size: 1.2em;
    line-height: 1em;
  }
  p {
    font-size: 1em;
    line-height: 1em;
  }
}
}
@media only screen and (min-width: 768px) {
.circle {
  h1 {
    font-size: 1.6em;
    line-height: 1em;
  }
  p {
    font-size: 1.2em;
    line-height: 1em;
  }
}
}
            
          
!
            
              // if there is only one line of content you can put it with one less container: set margin-top = - line-height/2. ==> based on http://codeitdown.com/css-circles/ of Jose Vargas
//rest of example based on https://codepen.io/JTLR/pen/JfbuA
//article can be a div, an li or any other element
//play wiht the .circle:before margin-right or margin-top
//attention: estrange behaviour of text in last circle due to space separation in html between the  <div class="circle"> and the <h1> ¿any idea why? 

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console