Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Assigning IDs to divs

From: Preparing CMS Web Graphics and Layouts Using Open Source Tools

Video: Assigning IDs to divs

All right! Our next task is to assign IDs to all of these divs that we just created and we might start to give them a basic style as well. KompoZer has a great tool for creating styles within KompoZer, and you don't have to know a whole lot of HTML to use it. It's this icon at the top called the CSS Editor and if you click that, you'll see that we have a screen where we can have an internal style sheet and I am going to show you how to make an external style sheet.

Assigning IDs to divs

All right! Our next task is to assign IDs to all of these divs that we just created and we might start to give them a basic style as well. KompoZer has a great tool for creating styles within KompoZer, and you don't have to know a whole lot of HTML to use it. It's this icon at the top called the CSS Editor and if you click that, you'll see that we have a screen where we can have an internal style sheet and I am going to show you how to make an external style sheet.

Remember that an internal style sheet means that the styles are incorporated at the head of the document, using the style tag. These are called embedded style sheets, another term perhaps you've heard somewhere. An external style sheet is a separate file with all the styles in it. Most content management systems are going to work better with an external style sheet than they will with an internal style sheet, and it will make maintenance easier in the long-term. So what we're going to do is I am going to click on Internal stylesheet and I'm going to say Linked stylesheet.

It's going to ask me some questions here and I'm just going to say Create Stylesheet. When I go back to Internal stylesheet, I now get to say Export stylesheet and switch to exported version. It will ask me what I want to call that stylesheet. Now if I was building this site for Joomla! and Joomla! templates, I would need to have a folder called images and I'd need to have a folder called css. My images folder contains my sliced-up graphics and my css folder would contain the style sheets that I'd be using with my Joomla! template.

Other content management systems may have different structures they require for organizing your style sheets and your images. You may want to follow that structure instead. I'm going to go into the css folder and I am going to call this default.css. You'll see that the screen updates so that we have css, the folder, default.css, which is the name of the stylesheet up here in the left-hand column. If I click the plus sign, you don't see anything underneath. That's because we haven't created any styles yet.

Now let's go ahead and create some styles. I am going to once again go to the Paint icon and I'm going to go to Style rule, which will create a new style for me. And as you can see, I can create many kinds of styles. I am just going to create a custom style rule and I'm going to call this first one #wrapper and I am going to create the style rule. At this point I can assign various attributes to the style that I just created. In the case of wrapper, this is the div that's outside of everything.

This is a fixed width design, so we're going to want to make wrapper 900 pixels wide. Why 900 pixels? Because that's how wide the graphic designer designed the graphic, the white area of the webpage. So I am going to go to Box and I am going to set the Width to 900 pixels. I'm also going to set the Left Margin to auto and the Right Margin to auto. This little trick here will center the wrapper div directly in the middle of the webpage, and all the other divs will become 900 pixels wide as well, and they'll fit nicely inside.

Next, I am going to create another style. Once again back here to the Paint palette and saying new style rule. I am going to create one called #header, and at this point I am just going to create a whole bunch of styles without assigning any more attributes to them. We'll go back and we'll assign the attributes in a little while. We'll create a style rule for nav. We'll create a style rule for contentwrapper. We'll create a style rule for content.

We'll create a style rule for left, and we'll create a style rule for footer. Now that we've created all of these IDs, now we need to go and assign them to the divs. So I am going to say OK, which will close the Stylesheet window, and now what I am going to do is, using my DOM Explorer, I'm going to select the first div. Down here in the breadcrumb, if I right- click on div, there's a flyout here for ID and I can choose wrapper.

See how that shrunk in the width and it's centered it nicely on the page. Note that the bar on top tells you that it's 900 pixels wide now. So that's our first div. Our second div is header. So once again this is a right-click or a Ctrl+Click on the div, ID > header and the ID of nav, the ID of contentwrapper, the ID of left, and the ID of content, and finally the ID of footer.

So all of our divs have been assigned IDs and we're ready to start doing some more styling and dropping some images into our design, which is what we'll do next.

Show transcript

This video is part of

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

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.


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.

Join now Already a member? Log in

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 Preparing CMS Web Graphics and Layouts Using Open Source Tools.

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


OK
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 preferences from the dropdown menu.

Continue to classic layout Stay on new layout
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
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.