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

              
                
<div class="wrapper">
  <div class="text-box">
    <h2><span class="text-code">text-overflow: ellipsis;</span>(1行のみ)</h2>
    <p class="text1">
      1行の文章の行数を制限&語尾を3点リーダーにする方法。1行の文章の行数を制限&語尾を3点リーダーにする方法。1行の文章の行数を制限&語尾を3点リーダーにする方法。
    </p>
  </div>
  <div class="text-box">
    <h2><span class="text-code">display: -webkit-box;</span>(複数行可)</h2>
    <p class="text2">
      複数行の文章の行数を制限&語尾を3点リーダーにする方法。複数行の文章の行数を制限&語尾を3点リーダーにする方法。複数行の文章の行数を制限&語尾を3点リーダーにする方法。複数行の文章の行数を制限&語尾を3点リーダーにする方法。
    </p>
  </div>
</div>
              
            
!

CSS

              
                .text1 {
	white-space: nowrap; /* 折り返し無しにする */
	overflow: hidden; /* はみ出た部分を非表示 */
	text-overflow: ellipsis; /* 語尾を3点リーダーに */
}

.text2 {
	display: -webkit-box; /* 必須 */
	-webkit-box-orient: vertical; /* 必須 */
	-webkit-line-clamp: 3; /* 行数を制限 */
	overflow: hidden; /* はみ出た部分を非表示 */
}

/* ↓ここからは見た目のスタイル */
body {
	background: #3689B5;
	font-family: "Noto Sans JP", sans-serif;
	font-size: 14px;
}

.wrapper {
	padding: 5%;
	max-width: 500px;
	margin: 0 auto;
}

.text-box {
	border-radius: 15px;
	color: #075986;
	background-color: #FEFEFE;
	padding: 2em;
	line-height: 1.7;
}

.text-box:first-child {
	margin-bottom: 40px;
}

h2 {
	font-size: 18px;
	margin-bottom: 1em;
}

.text-code {
	font-size: 21px;
	font-family: "DM Sans", sans-serif;
}

              
            
!

JS

              
                
              
            
!
999px

Console