Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
The power of CSS not only lies in the control it gives you over the design but the fact that you have the style separate from the content, and this separation really gives us flexibility to apply the style across multiple pages. So currently as you can see, this index page has a style applied to it, and it's looking pretty good, as opposed to some of these other pages, the about.html, contact, even the portfolio pages. These other pages if you look in the CSS Styles panel, I don't have any sort of styles, any rules applied to them, and what I want to do is I want these other pages to look more like the index page.
So, if you will notice, for this index page, I have all of these various CSS rules, and really I want to take these and I want to separate this into its own file, all of these rules and I want to apply that file to the other pages. So, all I need to do is select all of these rules. So I've just Shift+Selected all of the rules and I'm going to do a right-click or Control-click if you are on a Mac, and I want to move all of these rules.
I'm going to move all of these rules to an external style sheet. I'm going to select a new style sheet. This is what I want to create. I'm going to select OK and I'm going to go ahead and put it in my CSS folder in here. I am going to give it a name of janedoe. So, it's going in the CSS folder. It's called janedoe.css, because it's going to sort of define the style for this entire site. I'm going to click Save, and sure enough this page doesn't look any different, which is exactly what I want to happen.
But if you look in CSS Styles panel, it now says janedoe.css and all of the individual rules are located in this CSS file. In fact, I even have a quick link. Using this File Navigator bar, I can jump to that CSS as well. So again, it's easy to access that CSS file. But it's still connected to my Source Code or to this current page. So, now that that's separated out, it's in that janedoe.css file.
I can take this CSS file and I can apply it to the other pages. So, I'm going to go to the about.html page, and it's really quite easy because all I need to do is go to my CSS Styles panel, and I'm going to link by clicking on this Chain-link icon. I'm going to attach this style sheet that I just had created to this about.html page. So, I can type in a URL, I'm going to actually click Browse instead of typing any URL, but I can go ahead and go in my CSS folder and locate the janedoe.css file I just made.
So, I have it selected, click and Choose, and it's just going to link that CSS and that's what I want to do. I don't want to import all of that content, I want to link to that file. I can also choose the Media type. So, this is just to get you familiar with some of the other options. I could have a CSS layout for print, for a handheld, so you can have a lot of flexibility here and you can have sort of multiple CSS pages associated with sort of one page if you wanted to.
But really I'm building this for the common web browser on sort of a common computer system, so I'm choosing screen. Let's select OK, and let's see what happens. There we are. Sure enough, it applies that style, and it's looking pretty darn good. In fact, if I look in my CSS Styles panel, you can see here is my janedoe.css. I then twirl down and I can see all the CSS styles are in there. One issue you might notice is that this content isn't in a box, like I'd really want it to be, and in general, I don't have to necessarily draw a new absolute position to div.
I need to define it as a division of content and I need to apply this content style to it. So, I have selected all this text, and I'm going to go to my Layout tab and I'm going to make sure I'm in this Classic workspace mode, and I'm going to select this first button. I'm going to insert a div tag. So, this is a division of content that I'm defining. So, I'm going to make sure this div is wrapped around all of this content and I want to give it an ID of content, because that's what is in my CSS Styles panel.
So, I have given an ID of content, I'm going to select OK, and there you are. It defines this page and it gives me that division of all of that content. I want to do that across the board because I want to go to the contact page and really it's the same process. It's attaching a style sheet, browsing to that specific style sheet, again, it's in the CSS folder, click Choose, change my Media type, which technically isn't necessary, but it's a good practice. Select OK.
It applies that style and again the same process of selecting the content and then wrapping it, sort of defining it as its own area and making sure the content CSS rule is applied to that area. So, it's coming along nicely. The last section is the portfolio section. So again, attach my style sheet, browse to it, janedoe.css, click Choose, change my Media type to screen, select OK, and wrap in a content.
And making sure it applies the content CSS rule. Just like that. So, here we have four pages. They all finally look like a complete site and sort of are all associated to this one janedoe.css. In fact, if I come in here and I change the h2 rule, for instance, and what I want to do I want to maybe italicize the text. So, I'm going to click Apply, and it italicized this text.
I just need to change it in this one place and if I go to these other pages, I can see that text is italicized. So not only do you have a lot of control over your design, but you can easily change your design in one location, and it will change all of the pages that are associated with that CSS file.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.
Your file was successfully uploaded.