Learn the fundamentals of HTML and CSS, while building a strong foundation for more advanced front-end development.
Inspired by Front-end Foundation on CodeSchool
Copy the following code in an prependers-band.html file and follow the exercises below.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
Open Source Records
The Prependers
Bio
The Prependers are a quirky four-piece from Orlando, FL.
Critics have hailed them as the greatest post-garage-rock
band of the last decade.
They are currently writing a full length album that's a
follow-up to their breakout 2011 album, Top Right Bottom Left,
and their critically acclaimed EP, Opacity Zero.
Members
Jack Smith - Vocals
Sarah Quan - Guitar
Laverne Butlet - Bass
Simon St. Hollister - Drums
Albums
Top, Right, Bottom, Left
The Last
Downtown
Yellow Carpet
Rocket to Mars
Walk, not Run
Design
Shopping Cart
Our Gift to You
Opacity Zero
Visible/Invisible
Car Trip
AFK
Up and Up
Tour Dates
The Prependers are not currently on tour because they
are recording their new album. Check back later!
</body>
</html>We've been hired to create a home page for Open Source Records. They've only got two bands on their roster, but they are growing fast, so let's get started!
h4 tag.We just added the band members and song titles to the page. Decide the best tags to mark up that content, and don't forget to nest and indent tags when necessary!
Do your best to format the following HTML. Save it in a file called regular-band.html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
Open Source Records
Regular Expressions
Bio
Regular Expressionists are a hip-hop trio from New York City.
Members
Rekt - Vocals
Face-like - Vocals
DJ Regex Capture - Decks
Albums
This group has no albums released, but they are recording one album right now.
Tour Dates
July 16th, 2014 @ 7:00pm
House of Blues - Orlando, FL
July 17th, 2014 @ 7:30pm
Jannus Landing - Tampa, FL
July 19th, 2014 @ 8:00pm
The Tabernacle - Atlanta, GA
July 20th, 2014 @ 7:30pm
40 Watt Club - Athens, GA
</body>
</html>About, Bands, and Contact that is in between the main site name and the band's name (in both files)About into a link to the page about.html.Bands into a link to the page bands.html.Contact into a link to the page contacts.html.about.html, bands.html and contacts.html pages by saving and formatting the snippets belowabout.html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
Open Source Records
About
Open Source Records is a quickly growing record label that
brings you the hottest up-and-coming groups. All of our bands
are actively recording and touring, and receive our full support
producing, recording, mixing, touring, and promoting their work.
At Open Source Records, artists come first.
</body>
</html>bands.html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
Open Source Records
Bands
The Prependers
Regular Expressionists
We're always looking for new talent, so Contact us now!
</body>
</html>contact.html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
Open Source Records
Contact
</body>
</html>band.html has 3 addiional links. Can you spot them?We've done a good job structuring the content of our page with the right HTML tags, but the way those tags look is pretty boring right now. Let's start fixing that!
Inside prependers-band.html file:
a tag and removes the underline from the text using the text-decoration property. Also change their color to darkblue.p tag and changes the text color to dimgrayli tags that are children of an ordered list and make their font-size 20px.h2 tag and sets the font-size to 28px.h3 tags and sets their font-size to 26px and their color to darkblue.Convert the colors on our page to hex.
h1 and h2 text to the hexadecimal version of black.h3 tags to a slightly lighter version of black, and the h4 tags to an even lighter version than that.#112E10, #11EE00, #444444, and #FF0000, set the color for all paragraph text to the one closest to a darkish gray color.We've gone ahead and reset all of the styles on regular-band.html, and your job is to get the layout back to a good place!
Copy the style block from the prependers-band.html and add the following at the top
html, body, h1, h2, h3, h4, ul, ol, li, p, a {
padding: 0;
border: 0;
margin: 0;
}h1 tag so there's 15px of margin-bottom space between the Open Source Records header and the site navigation.h2 tag so there's 15px of margin-top space between the band's name and site navigation.h3 tag so there's 15px of margin-top space above the heading text.h3 tag again so there's a border-bottom with a value of 1px solid #cccccc.ul tag so there's 30px of padding-left and the unordered list item bullets will be visibleli tag so there's 5px of margin-bottom and the text in the list items won't be so close together.body tag so there's 15px of padding to create space between the edge of the window and all of the other content on the page.Copy the styles you wrote for the Regular Expressionists page over to prependers-band.html, and see some issues popping up. Go through each of these tasks and fix up some of those issues.
The Bio section the page contains two paragraphs, but they are appearing too close together.
Adjust the p tag so there's 10px of margin-bottom space for the bottom of the any paragraphs.
In the last challenge, we fixed the ul styles so we could read the bullet points, but that page didn't have any ol tags.
Adjust the ol tag so there's 20px of padding-left space and the album track numbers should line up with the album name headings.
Our song list items look good now, but there's another problem - we didn't have album names on the page in the last challenge, so our album titles here don't have the correct spacing.
Adjust the h4 tag so there's 10px of margin space above and below the album name headings.
We've got some cool CSS and we'd like to make it available to every page on our site. It doesn't make sense to copy that CSS <style> block to every page, because that means we'll have to update all of them individually whenever we make a change.
Instead, let's move our CSS to a new file and link that to each page so our CSS is all in one spot.
prependers-band.html over to a new file named main.css.style tag in prependers-band.html with a link tag that loads main.css.html filesWe can use class attributes applied to HTML tags so they can be specifically targeted in CSS.
Let's organize our HTML and CSS styles with some classes.
class attribute to the unordered list, and set the name of it to nav.main.css file, and set the padding for the .nav selector to 0 in order to remove the space that's appearing before the site navigation..nav li items to display horizontally with inline instead of their default block-level appearance..nav li items are appearing a little too close together. Add 20px of padding-right space so they have some room to breathe.That right padding is being applied to every navigation list item - even the last one on the right, which doesn't need any padding.
Use the :last-child pseudo-selector to set the padding-right value to 0 to remove the extra space on the last navigation list item.
In regular-band.html, the tour dates on this page are another great spot to use classes.
We don't need to add a class to the <ul> that contains the tour dates, but we do need a way to access the date/time paragraph tag and the concert location paragraph tag separately.
day-time to each paragraph tag that contains a date and time.concert-location to each paragraph tag that contains a location..day-time class color to #444444 and change the .concert-location class color to #888888.Let's change the text so that it stands out a little better too.
For both the .day-time and the .concert-location, add a text-decoration of underline.
t would be great to style the page header differently from the rest of the content, so let's add some divisions and classes to help us do that.
div container, and give that tag a class of header.div container, and give that tag a class of content-section.Now that we have the divisions in place, let's switch over to the main.css file.
Before we had separate divisions, we added 15px of padding to the entire body.
Now, we want our divisions to have better control over the page, so set the padding for the body selector to 0.
Alternatively, since the padding is already being set by the CSS declaration at the very top, you could remove the body selector from the CSS and that works too.
15px of padding back to all sides, but this time add it to the header and content-section divisions.content-section doesn't get bigger than 450px, so use that number to set the content section's width.This div-with-a-class thing is pretty useful - and it looks like there's another place we can use it too.
Our designers want a dashed border around each of the albums and their track listings, so we need to group the h4 and ol tags that contain each album's song list.
There's information about two albums, and each album consists of an h4 tag and an ordered list.
Wrap each album name and track listing in their own divisions, and give those divisions a class attribute with the value album.
Now we can switch to main.css and target tags that have an album class in order to style them the way we want.
Use a class selector to add a 2px dashed border to the albums. When you're writing the border property, use the single-line version.
That border is a little too close to our content, so add 10px of space to the top and bottom along with 5px of space to the left and right between the content and border.
Use the single-line version of the padding property to add these four values.
5px of margin spacing between the two album divisions.Right now all of our content is aligned to the left of the screen, but it probably makes sense for some of this stuff to be centered on the page.
content-section division that contains all of the page's main content.h2 to the center inside the main content section.Align the Open Source Records h1 to the center at the top of the page.
Then, align the site navigation .nav to the center as well.
The band pages are starting to look really good, but we've got a new problem. When we click back over to bands.html, the list of bands doesn't look very good even when we wrap that content in div containers with .header and .content-section classes.
This is because most of our layout styles on the band pages were specific to classes that aren't yet on bands.html.
bands-list to the unordered list of bands.That border underneath the band names looks strange. This is because we have defined a very general rule for that heading tag.
In the main.css file, define a more specific rule to remove the border for h3 tags inside of the .bands-list.
Also, set the margin to 0 inside that same CSS selector
Next, select the .bands-list and remove the default bullet points with the list-style-type property.
Also, set the padding-left to 0 in order to remove the extra space before the band names.
Select only a tags that are children of the .bands-list and remove their underlines with the text-decoration property.
Also, change their color to #ff2244.
1px solid #555555 for the border around each of the li items in the .bands-list.Let's update The Prependers page to include images for their album covers.
Create an image element in between the album name and song list for the Top, Right, Bottom, Left album.
Make sure the image has an alt attribute with this text: "Top, Right, Bottom, Left album cover".

Create an image element in between the album name and song list for the Opacity Zero album.
Make sure the image has an alt attribute with this text: "Opacity Zero album cover".

While we're adding content images, let's go ahead and add band images to the bands.html page. Insert the images before the heading tags inside of each list item for The Prependers and Regular Expressionists.
Each band has their own image that is located in the images folder - and don't forget to add an alt description for each image!

Our designers sent over a new Open Source Records logo, so instead of just writing the record label name with simple text, let's replace that text with an image.
Replace the h1 tag with an image element that displays osr-logo.png. And don't forget to add an alt attribute to specify some alternate text too.

Removing that h1 tag and replacing it with a single image is what we wanted to do, but we've created several problems that will require us to modify our HTML and CSS.
First, our logo text was centered, but our logo image is not. That's because our h1 heading tag was block-level, but our img tag is inline-level.
Update the main.css file by adding a CSS selector for our .header img and set the display property to block.
margin property to 0 auto 15px auto, which will also add 15px of space between the logo and the site navigation.The next problem is a trickier one. In the last challenge, we removed the h1 tag and replaced it with an img tag. That's fine, but it also means that our highest level heading right now is an h2 tag, which isn't OK.
Each page should have one h1 tag, and the rest of the content should be organized with h2 and h3 tags. That means we need to shift our existing heading tag numbers down by one, and then update our CSS selectors to reflect that shift.
bands.html. Change any h2 tags to h1, and any h3 tags to h2.Do the same thing for the heading tags on prependers-band.html.
The band's name should be marked up with the h1 tag, followed by the page sections with h2 tags, and then the album names with h3 tags.
Fix regular-band.html, about.html and contact.html, also make the heading shift in your CSS. Remember, what was an h2 is now an h1, and so on.
Delete the existing h1 selector and rules, and then update the CSS selectors in main.css to reflect the new heading tag organization.
Now we're going to really spruce up the Open Source Records site by adding backgrounds with CSS.
Let's start by adding a background to the body of the page.
For the body selector, use the CSS shorthand background property to set the following value: #555555 url(images/bg-tile.png)

We're using the default values for position and repeat, so we don't need to set those separately.
Next, let's add a background to the header section.
For the .header selector, use the CSS shorthand background property to set the following value: #242424 url(images/bg-header.png) top center no-repeat

Next, let's add a background to the main content section of the page.
For the .content-section selector, use the CSS shorthand background property to set the following value: #dddddd url(images/bg-content.png)

We're using the default values for position and repeat, so we don't need to set those separately.
Now our links are too hard to read with the darker background.
For the .nav a selector, use the CSS color property to set the following value: #ee932a
The Prependers are putting out a new album soon, and Open Source Records wants to feature them on the About page. We'll do that with a container that shows a background image.
<div> container and give it a class of recording-now.main.css and select the new container with the .recording-now class selector. Set the dimensions of that container with a width of 440px and a height of 200px.Now, add a background to that container with the following value: #ffffff url(images/prependers-recording.jpg) top left no-repeat

about.html file, create a <p> tag inside of that .recording-now container with the text Recording Album Now!..recording-now p and set the font-size to 28px. You can also experiment with different color values and see the changes in the Preview section.Our "recording now" image is showing up, but it feels a little out of place. Maybe it will look a little better if we add a border.
.recording-now selector, add a border with a 1px solid value.4px of space between the border and the content.Much better, but our image isn't centered inside of the container anymore. As a result, the border is showing up on the right and bottom, but not at the top and left.
Adjust the background property so that it's set to center center instead of top left, and our image should appear directly in the center of the container.
If we look back at bands.html, it's a little annoying that the band image appears above the band name. Ideally we want the band image to appear directly to the left of the band name.
.bands-list img selector to float the images so the band image appears to the left of the band name.Uh oh - that doesn't look right. The float is working, but the display isn't what we expected.
To start fixing this, let's put some padding between the image and the band name.
For the .bands-list img selector, add a padding-right property with a value of 15px.
To finish fixing this, the band list item height needs to be set to at least the height of the floated image.
In this case, the floated images are 120px high, so update the .bands-list li selector to have a height with a value of 120px.
This float thing is pretty cool, and it seems like we can use it on prependers-band.html to put each album image on the same line as the album name.
img elements in the album container, and float them so the album image appears to the right of the album name.Reset the default font styles and sizes, so you're going to need to go in and manually set those sizes again.
Update the following snippet in main.css
html, body, h1, h2, h3, h4, ul, ol, li, p, a {
padding: 0;
border: 0;
margin: 0;
font: inherit;
font-size: 100%;
}body font with font-family to Garamond, and use serif as a fallback.font-family for each of the heading tags to Verdana, and use sans-serif as a fallback.body a font-size of 16px.h1 tag twice the size of the body font (using pixels).h2 size smaller than the h1, but larger than the default body size.h3 size bigger than the body size, but don't go any bigger than 22px.h1 and h2 font-weight bold.Some of our paragraphs and lists are a little hard to read at a glance because the text within each line is too close together. Let's adjust the space between those lines.
24px.22px.The Open Source Records contact form is the main way that they'll be able to learn about new talent.
We won't be hooking up the form responses to a server, but we can still create the form's HTML now.
form tag underneath the Contact heading.input tag with a type attribute set to text so that an aspiring band can enter their band name.label that says Band Name before the input field. Then add the appropriate attributes to the label and input so the two are related with the value band-name.input tag, add a new input tag with a type attribute set to submit. The value attribute should say "Tell us about your band".Instead of separate fields with a few different questions, Open Source Records has decided to just invite bands to tell their story. That story will probably be pretty long, so we should use some input types other than just text.
label that says Your Story and add a textarea element after it. Then add the appropriate attributes to the label and textarea so the two are related with the value your-story.label that says On Tour and add an input element after it. The type attribute for the input should be set to checkbox. Then add the appropriate attributes to the label and input so the two are related with the value on-tour.Our form looks pretty jumbled right now, so let's work on styling those different form elements.
label, input, and textarea, and set their display properties to block.15px of space at the bottom of each input and textarea so the form fields aren't stacked so close together.width of each input and textarea to 445px.font-size of each input and textarea to 20px so the text that's being entered is easier to read.font-weight of label elements to bold to further differentiate between the label text and the form field text.Now our form is looking good, but there are a few small details that need to be fixed.
input element with type=submit, and adjust the width to 165px.We want the checkbox to appear on the same line as the checkbox's label.
Use attribute selectors to select the input element with type=checkbox and the label element with for=on-tour, and adjust the display property to inline.
Hmmm, the input and label for the checkbox still aren't displaying side-by-side even though they've been set to display: inline;. In this case, that's because we've already got a rule that sets all input elements to a width of 445px, and since there's no more space for the checkbox on the right, it moves onto the next line.
Remove the width: 445px; rule from the existing input selector, and move it to a new attribute selector that only changes the width of input elements with type=text