octocatstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <p><a target="_top" href="http://codepen.io/romanrudenko/pen/wvxbd">Previous Step</a> 02.switchback <a target="_top" href="http://codepen.io/romanrudenko/pen/sKnmz">Next Step</a></p>

<div class="wrap">
  <div class="prop">1.prop<br>float:right</div>
  <div class="main">2.main<br>float:left<br>Fairly short text</div>
  <div class="end"><div class="realend">4.realend<br>position:absolute</div>3.end<br>float:right</div>
</div>

<div class="wrap">
	<div class="prop">1.prop<br>float:right</div>
	<div class="main">2.main<br>float:left<br>Call me Ishmael.  Some years ago &ndash; never mind how long precisely &ndash; having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world.  It is a way I have of driving off the spleen, and regulating the circulation.</div>
	<div class="end"><div class="realend">4.realend<br>position:absolute</div>3.end<br>float:right</div>
</div>
            
          
!
            
              html, body { margin: 0; padding: 0; font-family: sans-serif;}

.prop, .main, .end {
  opacity: 0.7;
}
.wrap {
	width: 400px; height: 200px;
	margin: 20px 20px 50px;
	border: 5px solid #AAA;
	line-height: 25px; 
}

.prop {
	float: left;
	width: 100px; height: 200px; 
	background: #FAF; }
.main {
	float: right;
	width: 300px; 
	background: #AFF; }
.end {
	float: right; position: relative;
	width: 100px;
	background: #FFA; }
.realend {
	position: absolute;
	width: 100%;
	top: -50px;
	left: 300px;
	background: #FAA; font-size: 13px; }
            
          
!
            
              // Now, let's flip the scenario and make this work properly - show the ellipsis element when the content is too long for the container. For demonstration reasons, we will create a new "realend" element within "end". The location of "realend" is defined relative to that of "end", so that when "end" is trapped in the corner, "realend" lands on the bottom right, and when "end" is free, "realend" is out of bounds.

// This is beginning to look like a proper text-overflow implementation, but all its plumbing is exposed and widths are fixed. 
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console