Start learning with our library of video tutorials taught by experts. Get started

Exploring CSS Positioning

HTML vs. CSS: Which does what?


From:

Exploring CSS Positioning

with Candyce Mairs

Video: HTML vs. CSS: Which does what?

The HTML and CSS Browser Team. And that's what we're going to take a look at. How do these two HTML, being one, and CSS being the other work together as a Browser Team. Well let's take a look. HTML and CSS work together in the browser to display your webpage hopefully in the way you want it to be displayed.
Expand all | Collapse all
  1. 1m 13s
    1. Welcome
      1m 13s
  2. 33m 20s
    1. Why CSS positioning?
      5m 50s
    2. HTML editors
      3m 18s
    3. Getting set up
      3m 39s
    4. Previewing pages in browsers
      3m 51s
    5. Customizing the HTML editor
      5m 32s
    6. Exploring browser variances
      5m 16s
    7. Browser extensions
      5m 54s
  3. 30m 33s
    1. HTML vs. CSS: Which does what?
      9m 55s
    2. HTML div tags
      4m 57s
    3. CSS properties
      6m 21s
    4. The CSS box model
      9m 20s
  4. 28m 46s
    1. Planning the page layout
      3m 47s
    2. Building the header box
      6m 23s
    3. Positioning with HTML
      3m 36s
    4. Positioning with CSS
      8m 21s
    5. Foreground vs. background content
      6m 39s
  5. 25m 44s
    1. Building the menu box
      5m 7s
    2. Adding the menu links
      4m 58s
    3. Formatting the menu with CSS
      6m 43s
    4. Positioning the menu with CSS
      8m 56s
  6. 21m 42s
    1. Adding the middle column
      6m 29s
    2. Creating a CSS rule for the column
      6m 20s
    3. Adding CSS rules for the column
      8m 53s
  7. 19m 49s
    1. Adding the right column and inserting images
      7m 33s
    2. Completing the right-column content
      4m 18s
    3. Formatting the right column using CSS
      7m 58s
  8. 26m 14s
    1. Understanding the float property
      6m 5s
    2. Applying the floats
      6m 1s
    3. Finishing the floats
      6m 24s
    4. Adding CSS properties to the right column
      7m 44s
  9. 30m 59s
    1. Setting up for background colors
      5m 49s
    2. Adding a footer
      8m 50s
    3. Adding the background colors
      7m 20s
    4. Positioning the footer
      9m 0s
  10. 16m 38s
    1. Comparing the web page to the graphic design
      6m 50s
    2. Adjusting the web page as needed
      4m 25s
    3. Adding the final touches
      5m 23s
  11. 2m 43s
    1. Closing thoughts
      2m 43s

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
Exploring CSS Positioning
3h 57m Beginner May 24, 2012

Viewers: in countries Watching now:

CSS enables you to control the look and layout of a web page much more precisely than you could with HTML alone, but it can be time-consuming to learn. In this workshop, expert developer Candyce Mairs makes styling a quick and easy process, walking you through the process of adding content to a web page and using CSS to position that content. Candyce explains CSS positioning concepts like the CSS box model, floats, and clears and demonstrates how HTML and CSS work together to create the look of your web page. By speaking the same language as the browser, you can learn to work with the browser to place content accurately and easily.

Topics include:
  • Previewing pages in browsers
  • Customizing the HTML editor
  • HTML vs. CSS: which does what?
  • Building the header area
  • Adding the navigation menu
  • Positioning using a float
  • Adding background colors and images
  • Comparing the web page to the graphic design
Subjects:
Web Web Design video2brain
Software:
CSS
Author:
Candyce Mairs

HTML vs. CSS: Which does what?

The HTML and CSS Browser Team. And that's what we're going to take a look at. How do these two HTML, being one, and CSS being the other work together as a Browser Team. Well let's take a look. HTML and CSS work together in the browser to display your webpage hopefully in the way you want it to be displayed.

You must add both HTML and CSS code in order to position content. So your working in both of those pieces within the browser. Now this coding you add to both pieces acts or creates a bridge between the two. So the HTML and the CSS can work together. Now this browser team allows you to create CSS rules for the page, and those CSS rules are displayed by the browser itself.

So what do those CSS rules tell the browser? Well there's actually two different types of CSS rules. The first type describes how the box should look, and we talk about that as the formatting side of CSS, and that's the easier side to learn. In other words, what font do we want to use to display this particular text and what size should it be? Along with a variety of other formatting properties within CSS. But we also have the CSS rules that tell the browser where it should be positioned in the window.

In other words where that particular item within the browser should be positioned. So the it there, is referencing whatever page element the browser is reading in terms of code. Now how does positioning work? Well let's take a look at that. Here is the basic layout of the page we're going to create in this course. It has Header area up at the top of the page that contains the name of our company.

Then we have a navigation menu in the left-hand column. And then basically, our pages are comprised of two columns of text. There also is a footer that is going to go at the bottom of the page. That footer area is not going to contain text, it's going to actually store an image at the bottom of our page. So we have five different parts to our webpage. So how can we set up the positioning for this specific page? Well, we start in the HTML side of things.

In our HTML coding, what we need to do is create boxes for content. And we use the DIV tag to create those boxes. We also need to give each box a name and what that does is ID that specific box. So, the browser knows which box you're talking about, especially since your page is going to have multiple boxes or multiple DIV tags on the page.

Now, what about the CSS side of things? Well, CSS is in charge of different things. So, what we do is reference the boxes by that name we gave it an HTML. In other words the ID name, and what that does is tell CSS which box we're talking about and then we can create rules for where to place that specific box that we're talking about. So HTML and CSS work together.

Now, let's talk about some of those positioning basics for our page content. So the first thing you need to do is create a box in HTML using a DIV tag. How do we do that? Well, we create the DIV tag, then we add an ID to the DIV. To give the box a name otherwise it's very confusing to the browser which box you're talking about. Then we create CSS rules for the box using that ID.

So, these bullets are referencing kind of an overview of the process. So I'll be giving you some examples of exactly what I"m talking about in each of these bullets. So we create CSS rules for the box using that ID that we added in HTML. What else do we need to do? Well, the CSS rules tell the browser how the box should look. And where it should be placed and the rules we create can include both of those items within it. So, in other words, we can say okay, this box should look this particular way and it should be placed in this particular spot.

So, we can create one rule to encompass both of those. So, HTML, how do we do that part? And what part does it play? Now let's take a look at the code, so you'll have a better understanding of answering that question. So HTML is used to create a box for content using the DIV tag. Here is a div tag, angle brackets with literally the DIV inside of it. And the DIV tag does have an opening and closing tag, so we do need two of them. Now here's an example.

We have a DIV tag, this one has an ID added to it called header and we plug in our closing tag. So what do we do at that point? Well, page content goes between those two tags. So here's my opening tag, here's my page content, here's my closing tag. So whatever you plan to put in that particular box goes between those two tags. What else do we need to do? Well, we name the box by adding an ID to the code. So within our DIV, we add that id.

This particular box is called header, and we can hook into the CSS piece by using that name. But the basics with regards to why we add this name, well, so the browser knows which box we're talking about. Our header image would go inside that area. And then we would have our closing DIV. Now it is possible to indent here, I could also take this tag and move it over. I could put all of this on a single line, the browser doesn't care, as long as the opening tag and the closing tag surround our image code.

So these do not have to be necessarially perfectly lined up in the browser source code in order for this to work. HTML doesn't care. It is much easier to read, however, if it's lined up. But I just want to mention that to you in case you were not aware and get concerned that, that isn't lined up so it might not work properly. Now, what about the CSS side of things? Well, we've created our HTML. Now we need to create CSS rules using the box name as the selector.

What does that look like? Well we know the box is named header. So what we do is put a pound sign in front of it, and add a left, curly bracket. And I call this a left curly bracket, because it's pointing to the left. Now we put in a specific CSS properties for where to place the box, how to make it look, what color is the background, all of those different items. And we do need a closing curly bracket, notice this one is pointed to the right.

So the postioning properties are placed within these CSS rules. And in using those, that is what a rule would look like. And the float property is a property specifically designed for positioning. So this is a float left, so in other words this is telling the browser take the box called Header and float it left. What we do is use floats and clears to position content. Now there are other ways to position content, but these are generally speaking the best methods to use for your page content.

So there's my header, and I call that particular one an ID because technically on CSS that's an ID. Here's our float left property, and we're all set. Now what we do is assign properties in CSS, to position each individual box. So what this one does is assign the clear property to our footer box. And that is how HTML and CSS work together as a team, to tell the browser where to position the different page elements.

And that's what we are going to take a look at when you actually go to build your pages. So the DIV tag is our friend in HTML. And the ID is our friend in CSS and we'll get those two teaming up to work together to properly display our web pages.

There are currently no FAQs about Exploring CSS Positioning.

Share a link to this course
Please wait... Please wait...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Exploring CSS Positioning.

Return to your organization's learning portal to continue training, or close this page.


OK

Course retiring soon

Exploring CSS Positioning will be retired from the lynda.com library on April 24, 2014. Training videos and exercise files will no longer be available, but the course will still appear in your course history and certificates of completion. For updated training, check out CSS: Page Layouts in the lynda.com Online Training Library.


Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Welcome to the redesigned course page.

We’ve moved some things around, and now you can



Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked