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

              
                <head>
	<meta charset="utf-8">
</head>
<body>

<div id="content">Diwali is one of the most important festivals in Hindu culture. It is one of the most important holidays in the Hindu calendar. Diwali gets its name from the Sanskrit word ‘Deepavali’ that roughly translates to ‘a row of lights.’ It is a great time to have fun with your family and friends. People decorate their houses with oil lamps and fairy lights at night. They cook delicious food and share them with their neighbors. It is a festival of lights; every street is lit up with beautiful lights. It spreads cheer and joy among people and makes them fall in love with their culture. 
<br>
<br>
Festivals have been made to reinforce strong bonds between families and friends, and Diwali is the best example. Everyone goes home for Diwali and celebrates it with their families. It is a national holiday, so everyone enjoys the festival without worrying about work. It gets more exciting at night because lots of sky-lanterns are released into the air that flies high and lights up the night sky. Diwali teaches us to be patient for good things in life.

Children keep waiting for many days to enjoy that bite of their favourite sweet. The houses are thoroughly cleaned to clean them of dirt. Cleanliness is very important as it would determine your wellness and health. It has been a part of Hindu culture for a very long time and fosters the moral lesson of “Good people always win over bad ones.</div>

<a id="show-more">SHOW MORE</a>
		
</body>
</html>
              
            
!

CSS

              
                body {
	background: orange;
}

#content {
	width: 50%;
	background: #fff;
	padding: 20px;
	font-family: Sans-Serif;
	font-size: 18px;
	color: #444;
	margin: 0 auto;

	max-height: 180px;
	overflow: hidden;

	/* Set Transitions */
	transition: max-height 0.7s;
}

#content.open {
	max-height: 1000px;

	/* Set transitions */
	transition: max-height 0.7s;
}

#show-more {
  width: 20%;
	background: #1594e5;
	color: #fff;
	font-family: sans-serif;
	display: block;
	cursor: pointer;
	text-align: center;
	padding: 15px;
  margin: 10px auto;
}
              
            
!

JS

              
                var content = document.getElementById("content");
var button = document.getElementById("show-more");

button.onclick = function () {

	if(content.className == "open"){
		//shrink the box
		content.className = "";
		button.innerHTML = "SHOW MORE";
	} else {
		//expand the box
		content.className = "open";
		button.innerHTML = "SHOW LESS";
	}

};
              
            
!
999px

Console