Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
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.
What I'm now going to do is modify the CSS Properties for the right column on our page. I'll be modifying properties for both the column itself, as well as content within that column. I've done that for the menu area, and also done it for the left column. So, now it's time to do the right column. The first thing I want to do is these two images are reverse from what they should be.
My seahorse should be on the left, and this orange clam should be on the right. And that's an easy fix. It's just taking the HTML for the seahorse image and moving it in front of the orange clam image. So I'll go ahead and do that, and now my seahorse is on the left, and the clam is on the right. Now, I think these images are a little bit tight on this left-hand side. My column is also up way too high, so my image is almost butting up against the upper header.
What I'm going to do is go out to the column itself, which is controlled by the right id in my CSS rules and modify that. Let me go up to the right ID within my CSS rules. And that's this one, right here with pound right. First of all, I have this border that I don't need anymore. So I will get rid of that border, just deleting it. You can see the border is now gone on my page.
Then next thing I want to do is move this image down. I'm going to add some Padding to the top of this column so that will automatically move my image down, and that is done in the right ID. I will add Padding-top, and the top Padding, I will put in as 44 pixels. Next, I'm going to add Padding Left to this column of 20 pixels.
What that's going to do is move everything in this column over to the right. So, there's a little bit more space between these columns. I think that looks much better. Now, my images are what I need to address next. How can I address all three images within the right column? Well, what I can do is say, if it's an image tag inside the right column. And that's just like I did with the Header 2 here, or the paragraph tag.
So, I will add a style here and say, if it's inside the right ID, and the space takes up an and, it's an image tag. I want to do something. And what I'm going to do is add some Padding on the bottom of all of these images. So, all three images will get a little more space underneath them. And doing it this way, based on the image tag, it will allow me to do them all at one time, which is really a nice feature. So, I'll do Padding Bottom of 25 pixels, and what that did was spread out my images just a little bit.
It also put some additional space underneath my last two images. Now, my seahorse here and my clam are a little bit too tight together. So, to get my clam to move up so that these two are exactly even, I can do it real quick in HTML. For my seahorse image, what I'm going to do is add a line equals loft. What that will do is move my seahorse image.
Now however, I have a little issue with this clam being a little bit too tight to my seahorse. And there are ways to modify that in HTML. But not as flexible as if we do it in CSS. So, what I want to do is put some left Padding on my clam image. How do I go about doing that? Well virtually, the same way we did it with the image tag itself. But if I use the image tag, it does it to all three images. So, how can I assign some CSS properties to just this clam image? Well, just like we assign an ID to a DIV Tag, I'm going to assign an ID to an image instead.
An ID can be assigned to anything within your page, an HTML tag included. Now that I have an ID here, assigned to this image, I can go up to the top. So, now up in my Style roles, I'm going to add an ID Style Role for clam. An ID always starts with the pound sign. And then I'll add my curly brackets, just like I've done with any other ID. In this one, I'm going to say Padding Left.
So, what I'm going to do is add Padding just to that left side of my image, and let me do 25 pixels there. Now, you can see I'm not quite after to the right-hand side. In terms of alignment, this also has a bit of an issue, it's come up a little too high. My left align on this image has pulled this text up because this image is too short. So I have two additional things I want to do.
Let me just raise the Padding Left to 40, and let's see what that does. And that lined it up pretty nice here. So, my clam is lined up. Now, what I need to do is take care of this Upcoming Events. And the way I'm going to handle this is I'm going to ad some margin underneath my clam. What that will do is push this down so that it will end up left aligned with the rest of my text. Let's take a look at that.
I will add margin bottom of 40 pixels, and let's see where we're at. Look at that. My margin bottom of 40 pixels took care of that particular issue. The last thing I need to do with regards to the right column is take a look at it in the browser. I'll go out to Internet Explorer, just to be different, and take a look at the layout of my right column, and it's looking pretty good.
I've now modified the CSS Properties, for the right column, the DIV itself, as well as the individual pieces of content within the DIV. You can see how handy CSS Properties are in order to manipulate content within your browser window.
There are currently no FAQs about Exploring CSS Positioning.
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.