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

CSS How to Make a Website Beginning HTML and CSS Write a CSS Selector and Property

what is a style tag?

Show me in code please that will be awesome or take a picture and post in the comments below this question. Thank You very much for those who have been answering the question. Thank You.

index.html
<body>
  h1 </style> 
    <h1>Nick Pettit</h1>
</body>

3 Answers

Ashley Franklin
Ashley Franklin
17,633 Points

Just like the above answer! :) Anything between those tags will be what you're styling and the properties used to do so

<!-- this is your opening style tag below -->
<style>
    h1 {
        font-size: 2em;
        color: red;
    }
</style>
<!-- closing style tag above -->

A style tag is basically an indicator, or pointer to the presence of CSS in the document or web page. Inline style can be placed in a specific spot within a page, but should only be used where there will be a single instance of specific styling that won't be repeated anywhere else, or you'll have to change it whenever you edit the page. Styling for an entire page can be placed at the head of a page, but again, if dealing with a multi-page website, the styling will have to be updated for each page. The preferred way to apply style to a page or site, is to include a link to a separate CSS styling document, which can then be applied to the entire site, and when edited, will apply overall and will save you lots of time and effort, in terms of maintaining a multi-page website. So, whenever you see a style tag, look for the CSS--it'll be there, or will point you to where you'll find it. http://teamtreehouse.com/workspaces/1969992#

John Hartney
John Hartney
2,893 Points

Just to complement this post I thought I might add some info about the "style" attribute,

I have always added a type="text/css" inside my style tag but it's actually not necessary as it works with or without the type indicator with html5, even with early version of IE however...

when working with Microsoft SharePoint 2003, the "type" attribute is used when processing HTML, just thought I'd mention that because it's somewhat confusing.

<style type="text/css">
  h2. {
    margin-top: 0px;
  }
</style>