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.

            
              <h1>My personal take on how to style half of a character</h1>
 <p>Taken from this post: <a href="http://stackoverflow.com/questions/23569441/is-it-possible-to-apply-css-to-half-of-a-character" target="_blank">Is it possible to apply CSS to half of a character?</a></p>
<hr>
<span class="half-character"></span>
<div class="notes">
  <h3>Personal notes:</h3>
  <ul>
    <li>The main reason I did this was to test myself and see if I was able to accomplish styling half of a character while actually providing a meaningful answer to the OP.</li>
    <li>I am aware that this is not an ideal or the most scalable solution and the solutions proposed by the people in the post are far better for "real world" scenarios.</li>
    <li>The CSS code I created is based on the first thoughts that came to my mind and my own personal approach to the problem.</li>
    <li>My solution only works on symmetrical characters, like X, A, O, M. ** It does not work for asymmetrical chracters like B, C, F, K or lower case letters.</li>
    <li><strong>** HOWEVER</strong>, this approach creates very interesting 'shapes' with asymmetrical characters. Try changing the X to a K or to a lower case letter like an <em>h</em> or a <em>p</em> in the CSS :)</li>
  </ul>
</div>
<hr>
<p>Created by <a href="http://ricardozea.me/" target="_blank">Ricardo Zea</a></p>
<time datetime="5-16-2014">Created on: April, 2014</time>
            
          
!
            
              .half-character { display: inline-block; font: bold 350px/.8 Arial; position: relative;
  &:before, &:after {
    content: 'X'; //Change character here
    display: inline-block;
    width: 49%;
    overflow: hidden;
    color: #7db9e8;
  }
  &:after {
    position: absolute;
    top: 0;
    left: 49%;
    color: #1e5799;
    transform:rotatey(-180deg);
  }
}

/*Styling stuff, not needed for demo*/
.half-character, .notes { text-align: left; }
h1 { text-transform: capitalize; }
time { font-size: 11px; color:rgba(white,.2); }
.notes { width: 80%; margin: 50px auto 0; padding: 10px 20px; background: rgba(black,.15); font-size: .9em; }
.new-window { position: relative; padding-right: 16px;
  &:after { content:''; display: block; width: 14px; height: 12px; position: absolute; top: 10%; right: 0; background: url(https://i.stack.imgur.com/3H2PQ.png) no-repeat; }
}

            
          
!
            
              //Add a title to the links that open in a new tab/window
$("a[target='_blank']").attr({title:'Opens in a new tab/window'}).addClass('new-window');
            
          
!
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