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 Make a Website Creating HTML Content Use the Navigation Element

CSS

Explain the css embedding

2 Answers

Hi Sanchari, this seems like a vague request! What in particular are you having trouble with? Do you mean inserting CSS into an HTML doc without a stylesheet? It's like adding a second language to the page with a reference for the computer to read it. It is usually better practice to link to a stylesheet though.

CSS defines how elements are displayed on a page. Without linking your CSS files to your HTML, there is no clear-cut way for the HTML to adapt to the styling you have designated in your style sheet.

To do this you would place similar code in the head of your HTML file, and by doing so the browser will be able to style the page accordingly.

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

External style sheets are idea to keep your work separate especially for projects with multiple pages or large quantities of content. But you can also include CSS internally, inline, in multiple forms, but those are intermediate to advanced practices you should use with moderation.