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 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.