Skip to main content
Menu
CodeBabes
  • Create new account
  • Request new password

or

  • Sign in with Twitter
  • Code
  • Babes
  • Sign Up
  • Log In

Pass the QUIZ to the Where to Stick your CSS video

CSS Virgin Quiz

Study More
CSS Virgin

Which part of the following code is the CSS property?

selector {
  font-size: 12px;
}

Which one of Justin Timberlake's songs would be about CSS?

Which part of the CSS targets the HTML?

What is wrong with this CSS?

selector {
  font-weight; bold:
}

The Big Lebowski is a perfect movie.

Share the Love

  • Tweet

Where to Stick your CSS

Before we get too far into the details, let's talk about where you stick your CSS.

CSS is all about separating content from presentation. Take me for example, my hotness is my presentation, or the CSS, my personality, is the content, the HTML. When you put together great content and great presentation you end up with a pretty bangin’ website, or this hotness.

First, the best practice way to add CSS to a web page is to create a separate CSS file, or an external stylesheet. Let’s take a look at the site directory on our desktop. Inside is an HTML file and a CSS file. If we open the HTML file in a browser we see it is just plain text. Let’s open the HTML file in a text editor. Ok, so what we have to do is add the stylesheet to the HTML file with this line, link—rel-stylesheet then, href—equals—the the CSS file path within the site directory.

Let’s go back and refresh the page. Since we linked the CSS file, now the browser applies the external CSS and the content is styled. This method works great because one file can be applied to many pages.

But, if you like it quick and dirty, there are two other ways to add CSS. First, is an inline style where you add the style directly to an HTML element in the page. Let’s add a background color of gray. Inline styles aren’t good because it forces you to edit each page individually to change the style. This is known as tight coupling, and let me tell you, as good as that sounds, it isn’t.

Second is an internal style. You stick this right in the page, inside the head element. You add the style tag and then some CSS. Let’s make the paragraphs bold, by adding a p then font-weight, bold.

This method is slightly better than inline styling, but you still have the same problems, it’s attached to one HTML file.

In conclusion, external stylesheets are good because they can be applied to many HTML files and on a more advanced level it helps make page loads faster because once the browser loads this file, it remembers it and doesn't have to download it again. This is called browser caching.

Next we’ll talk about properties, specifically color and size options, and it might be a little hotter in here, if you know what I mean.

Questions or Comments?

Lessons

  • Where to Stick your CSS
  • CSS Properties, Sizes and Colors
  • CSS Selectors
  • CSS Box Model
CSS Virgin

Downloads

SignUp & Subscribe

What the What?

Lessons: 41

Much more to come!

50/50 Entertainment and Education. Learning doesn't have to be boring :)

Our Philosophy

Contact

  • support
  • Tweets!
  • Youtube
  • Google Plus
  • Facebook

Stuff

  • Blog
  • Sign Up
  • All Babes
  • All Courses
  • Become a CodeBabe!
  • MAKE A LESSON WITH CODEBABES!

Recent Courses

Internet Virgin
SEO Virgin
HTML Virgin
CSS Virgin
Programming Virgin with Javascript

Learn to Code with Babes

Copyright © 2025 CodeBabes.com • Made with

  • Privacy Policy
  • Terms of Use
Close Menu
  • Blog

  • All Courses
  • Android Virgin
    • Android Studio Tour
    • App Layout in Android Studio
    • Java Variables, Java Data Types & Android Views
    • Java Event Handling in Android
    • Android Intents, OOP This, Variable Scope
    • Passing the Data with Android Intents & Finish
    • Complete the Android App with Launcher Icons & APK
    • Android Happy Ending
  • Internet Intro
    • Backend Development
    • Front End Web Development
    • Programming Tools you Need
    • Hosting and Domain Names
  • HTML Virgin
    • HTML Text Tags
    • HTML Links and Images
    • HTML Layout with HTML 5
    • HTML Tables
  • CSS Virgin
    • Where to Stick your CSS
    • CSS Properties, Sizes and Colors
    • CSS Selectors
    • CSS Box Model
  • Programming Virgin
    • Variables in Programming
    • Programming Intro Conditional Statements
    • Programming Intro to Arrays
    • Programming with Loops
    • Programming with Functions
  • PHP Virgin
    • PHP Variables
    • PHP Conditionals
    • PHP Arrays
    • PHP Loops
    • PHP Functions
  • SEO Virgin
    • Make Google Love You
    • Understanding Keyword SEO
    • Optimizing for SEO
    • Technical SEO