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
via CSS Lint

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
via JS Hint

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.

HTML

            
              <h1>max-width</h1>

<figure class="demo">
  <p class="max max600">Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
  <figcaption>Width = 80% / Maximum Width = 600px</figcaption>
</figure>

<figure class="demo">
  <p class="max max320">Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
  <figcaption>Width = 100% / Maximum Width = 320px</figcaption>
</figure>

<figure class="demo">
  <p class="max max-percent">Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
  <figcaption>Width = 100% / Maximum Width = 50%</figcaption>
</figure>

<figure class="demo">
  <p class="max em40">Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
  <figcaption>Width = 100% / Maximum Width = 40em</figcaption>
</figure>

<figure class="demo">
  <p class="max rem40">Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
  <figcaption>Width = 100% / Maximum Width = 40rem</figcaption>
</figure>

<h3>Tables</h3>
<figure class="demo">
  <table class="max maxtable">
		<thead>
			<tr>
				<th class="chrome"><span>Chrome</span></th>
				<th class="safari"><span>Safari</span></th>
				<th class="firefox"><span>Firefox</span></th>
				<th class="opera"><span>Opera</span></th>
				<th class="ie"><span>IE</span></th>
				<th class="android"><span>Android</span></th>
				<th class="iOS"><span>iOS</span></th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td class="yep-nope">24+</td>
				<td class="yep-nope">5.1+</td>
				<td class="yep-nope">18+</td>
				<td class="yep-nope">12.1+</td>
				<td class="yep-nope">8+</td>
				<td class="yep-nope">1.0+</td>
				<td class="yep-nope">2.1+</td>
			</tr>
		</tbody>
	</table>
  <figcaption>Width = 100% / Maximum Width = 600px</figcaption>
</figure>

<footer>
  <p><small>*These examples use the entire viewport width in order to understand and grasp the concepts outlined. Squeeze your browser to witness the results.</small></p>
</footer>
            
          
!

CSS

            
              @import "compass/css3";

//========================================
// $Global Styles
//========================================

html {
  background: #444444;
  color: #ffffff;
}

.demo {
  background: #000;
}


//========================================
// $Maximum Width Demo
//========================================

.max {
  background: #e78629;
}


// Max-Width Length Values
// ========================================

// maximum 600px
.max600 {
  width: 80%;
  max-width: 600px;
}

// maximum 320px
.max320 {
  width: 100%;
  max-width: 320px;
}

// maximum 50%
.max-percent {
  width: 100%;
  max-width: 50%;
}

// maximum 40em
.em40 {
  width: 100%;
  max-width: 40em;
}

// maximum 40rem
.rem40 {
  width: 100%;
  max-width: 40rem;
}


// Max-Width TABLES
// ========================================

// maximum 30em
.maxtable {
  width: 100%;
  max-width: 600px;
}
            
          
!

JS

            
              
            
          
!
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