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

              
                <p class="safari" lang="fr">Cette démonstration ne marche qu’avec Safari (en version <i lang="en">desktop</i>).</p>

<div class="ellipsis">Lorem ipsum dolor sit amet consectetur adipisicing elit. </div>

<div class="ellipsis ok">Lorem ipsum dolor sit amet consectetur adipisicing elit. Possimus aliquid velit veritatis qui libero ipsam sint error vel excepturi fuga voluptate pariatur quibusdam, iusto dignissimos, quam unde eos at? Ducimus.</div>

<div class="ellipsis ok" title="">Lorem ipsum dolor sit amet consectetur adipisicing elit. Possimus aliquid velit veritatis qui libero ipsam sint error vel excepturi fuga voluptate pariatur quibusdam, iusto dignissimos, quam unde eos at? Ducimus.</div>

<div class="ellipsis pseudoElement">Lorem ipsum dolor sit amet consectetur adipisicing elit. Possimus aliquid velit veritatis qui libero ipsam sint error vel excepturi fuga voluptate pariatur quibusdam, iusto dignissimos, quam unde eos at? Ducimus.</div>

<div class="ellipsis">
	<div></div>
	Lorem ipsum dolor sit amet consectetur adipisicing elit. Possimus aliquid velit veritatis qui libero ipsam sint error vel excepturi fuga voluptate pariatur quibusdam, iusto dignissimos, quam unde eos at? Ducimus.
</div>
              
            
!

CSS

              
                .ellipsis {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pseudoElement {
	&::before {
		content: '';
		display: block;
	}
}

















@layer demo {
	.ellipsis {
		position: relative;

		&::after {
			content: '';
			position: absolute;
			inset: auto 0 0;
			height: 2px;
			background-color: green;
			transform-origin: 0 0;
			transform: scaleX(0);
		}

		&.ok {
			@media (hover: hover) {
				@supports (background-image: -webkit-named-image(i)) {
					background-color: color-mix(in srgb, green, white 80%);

					&:hover {
						&::after {
							transform: scaleX(1);
							transition: transform 1.5s linear;
						}
					}
				}
			}
		}
	}

	body {
		display: flex;
		min-height: 100dvh;
		gap: 1rem;
		box-sizing: border-box;
		padding: 1rem;
		flex-direction: column;
		justify-content: center;
		align-items: center;

		> * {
			background-color: color-mix(in srgb, black, white 90%);
			border-radius: 10px;
			padding: 1rem;
			width: 32.5rem;
			max-width: 100%;
			box-sizing: border-box; 
		}
	}

	.safari {
		margin: 0;
		background-color: color-mix(in srgb, red, white 70%);

		@media (hover: hover) {
			@supports (background-image: -webkit-named-image(i)) {
				display: none;
			}
		}
	}
}
              
            
!

JS

              
                
              
            
!
999px

Console