Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

How to select elements for new html page on website?

I'm making my friend a website for his storage company and have been using several techniques i've learned on treehouse. The index.html page is working fine and the site has a functioning navigation element. However, I can't adjust the margins and padding on any of the elements in my about.html page and I have no idea why. I've tried calling several different ID's and Classes but nothing seems to work.

2 Answers

Samuel Key
Samuel Key
3,310 Points

Did you include a link to your CSS file in the about.html page just like you did for index.html?

Erik S.
Erik S.
9,789 Points

Hi Dylan, its hard to say without the code, but maybe this approach will help you:

First try to apply inline style and see if your local setup is fine. Like this:

<h1 style="color:blue;margin-left:30px;">This is a heading.</h1>

Then move the style to an internal style sheet inside the head element, like this:

<head>
<style>
body {
    background-color: linen;
}

h1 {
    color: maroon;
    margin-left: 40px;
} 
</style>
</head>

If this still works, then move your styles to an external style sheet and reference it in the html

<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>

Or if you are already using an external stylesheet, quickly check, that path and filename are correct. If your styles show up great, if they still dont show up, check your page with the dev tools and maybe they are overwritten by another stylesheet? In that case include your stylesheet last. Hope this helps