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

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.

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

              
                
<body>
		<nav id="navbar">
			<img id="navlogo"
				src="https://images.unsplash.com/photo-1567446537708-ac4aa75c9c28?ixid=MnwxMjA3fDB8MHxzZWFyY2h8NXx8bG9nb3xlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=400&q=60"
				alt="">
			<ul>
				<li><a href="#home">Home</a></li>
				<li><a href="#about">About</a></li>
				<li><a href="#contact">Contact</a></li>
				<li><a href="#logout">Logout</a></li>
			</ul>
		</nav>

		<main>
			<h1>My Blog</h1>
			<p>This is my blog. Blah Blah Blah.</p>
			<h2>Recent Posts</h2>
			<div class="post">
				<h2>Learn CSS Selectors</h2>
				<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Officiis, non. A sequi
					accusamus consectetur voluptatum, itaque delectus sunt perferendis molestias
					dolorum
					quaerat id vitae adipisci. Repellendus quia praesentium pariatur consectetur.
				</p>
				<span><a href="https://hashode.com">Read More on Hashnode</a></span>
				<button><span>&hearts;</span></button>
			</div>
			<div class="post">
				<h2>Learn JavaScript Variables </h2>
				<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Officiis, non. A sequi
					accusamus consectetur voluptatum, itaque delectus sunt perferendis molestias
					dolorum
					quaerat id vitae adipisci. Repellendus quia praesentium pariatur consectetur.
				</p>
				<span><a href="https://hashode.com">Read More on Hashnode</a></span>
				<button><span>&hearts;</span></button>
			</div>
			<div class="post">
				<h2>Learn React and Hooks</h2>
				<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Officiis, non. A sequi
					accusamus consectetur voluptatum, itaque delectus sunt perferendis molestias
					dolorum
					quaerat id vitae adipisci. Repellendus quia praesentium pariatur consectetur.
				</p>
				<span><a href="https://hashode.com">Read More on Hashnode</a></span>
				<button><span>&hearts;</span></button>
			</div>
			<div class="post">
				<h2>Learn Python </h2>
				<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Officiis, non. A sequi
					accusamus consectetur voluptatum, itaque delectus sunt perferendis molestias
					dolorum
					quaerat id vitae adipisci. Repellendus quia praesentium pariatur consectetur.
				</p>
				<span><a href="https://hashode.com">Read More on Hashnode</a></span>
				<button><span>&hearts;</span></button>
			</div>
		</main>

		<footer>
			<ul>
				<li>Copyright something something</li>
				<li>April 2021</li>
				<li>
					Social Links
					<ul>
						<li><a href="www.facebook.com">Facebook</a></li>
						<li><a href="www.instagram.com">Instagram</a></li>
						<li><a href="www.youtube.com">Youtube</a></li>
					</ul>
				</li>
			</ul>
		</footer>

	</body>

              
            
!

CSS

              
                * {
	box-sizing: border-box;
}

  body {  /*DON'T TOUCH THESE STYLES */
  	width: 80%;
  	min-height: 100vh;
  	margin: auto;
  	padding: 20px;
  	border: 10px solid pink;
  	font-family: Arial, Helvetica, sans-serif;
  }


/* Give the <main> and <nav> and <footer> elements a width of 800 pixels and center them on the page*/

main,nav,footer {
	width: 800px;
	margin: 0 auto;
}

/* Give the element with the ID of navlogo a width and height of 100px*/
#navlogo {
	width: 100px;
	height: 100px;
}

/* Give all elements with the class of "post" a white background color, a a 5px pink border, a padding of 10px all round and a margin of 10px top and bottom*/
.post {
	background-color: white;
	border: 5px solid pink;
	padding: 10px;
	margin: 10px;
}

/* Select the li elements that are inside of the element with the ID of "navbar" and make 
1. them inline elements 
2. give them a padding of .8rem top and bottom and 1.2rem left and right
3. a background color of dodgerblue 
 */
#navbar li {
	display: inline;
	padding: .8rem 1.2rem;
	background-color: dodgerblue;
}

/* Select the first li element that is inside of the element with the ID of "navbar" and 
1. give it a background of rgb(218, 22, 185)
2. a text color of white;
3.give it font weight of 700
*/
#navbar li:first-of-type {
	background-color: rgb(218, 22, 185);
	text-align: center;
	font-weight: 700;
}

/* Select all buttons nested inside of elements with the class of "post", and give them a 2px pink border.*/
.post button {
	border: 2px solid pink;
}

/* Make all visited links teal */
a:visited {
	color: teal;
}

/* Select all links with an href attribute that begins with "www" and give them a color of rgb(218, 22, 185)*/
span a[href ^="www"] {
	color: rgb(218, 22, 185) !important;
}

/* 
Select each h2 that is nested inside of an element with the class of "post", and add an exclamation point to the end of the h2 (using ONLY CSS)

Basically add an '!' to the end of each blog post title.  Make sure the h2 that says "Recent Posts" is not included.
*/
.post h2:after {
	content: '!'
}

/* Select all paragraphs that are adjacent to an h1 and make them 20px font and give them a color of dodgerblue and center them on the page.  (there is only one paragraph that will be styled here) */
h1+p {
	font-size: 20px;
	color: dodgerblue;
	text-align: center;
}

/* Make the first letter of each paragraph in each blog post 
1.40px font size
2.a text color of rgb(218, 22, 185). 
Make sure you are only selecting the paragraphs nested inside of elements with the class of "post". Do not select the "This is my blog. Blah Blah Blah."paragraph */
.post p::first-letter {
	font-size: 40px;
	font-weight: bold;
	color: rgb(218, 22, 185);
}

/* Give every second blog post div (class of "post") a background color of rgba(0, 0, 0, .8) and a color of white.  Make sure you are styling every EVEN numbered post. The first post should be white, the second rgba(0, 0, 0, .8), etc.*/

.post:nth-of-type(2n) {
	background-color: hsla(0, 33%, 1%, 0.843);
	color: white;
}

              
            
!

JS

              
                
              
            
!
999px

Console