Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS How to Make a Website Styling Web Pages and Navigation Style the Image Captions

The property [ clear ]

In the video we put the clear property right after text-align.

footer {
    font-size: 0.75em;
    text-align: center;
    clear: both;
    color: #ccc; /* very light gray*/
    padding-top: 50px;
}```

Is it imperative to put it there in this case? Because i tried to put it at the end and it worked for me, and i just want to make sure about it!
Thanks!

2 Answers

Kevin Korte
Kevin Korte
28,149 Points

It's not imperative that it goes right after the text align. In this case, you could put it first, last, whatever inside that declaration. CSS for the most part does not care in what order you put declare your attributes inside of an element declaration like this. There is only one time when the order is imperative. Remember that CSS cascades, so in an easy example, if I had an element with the class box, and I wanted to style it like so.

.box {
height: 150px;
width: 150px;
background: blue;
border: 5px solid green;
background: red;
}

Than that box div would be red, because red is further down the list, and so it overrides our earlier background property of blue.

Ex http://codepen.io/kevink/pen/bstxu

Jacob Miller
Jacob Miller
12,466 Points

You can order your css properties however you want and it won't make a difference.

Kevin Korte
Kevin Korte
28,149 Points

There is a cascading effect even inside element style declarations. Order does make a difference, sometimes. Just not here in this example.

Jacob Miller
Jacob Miller
12,466 Points

Thanks for the correction. :)

Kevin Korte
Kevin Korte
28,149 Points

More of a side note than a correction :)