Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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