From the course: CSS Fundamentals: Unlock the Power of Web Styling

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Applying borders and backgrounds

Applying borders and backgrounds

- [Instructor] In this lesson, I'd like to talk with you about borders and backgrounds. And we'll start with borders. The CSS border properties allow you to specify the style, width, and color of an element's border. Similar to margins and paddings, borders can be defined from the top, right, bottom, and left sides individually. Borders syntax can get really wordy if you're specifying the style, width, and color individually. That's why I recommend going with the shorthand notation. This lets you set all three border properties at the same time for each individual side. Now, if all four sides are going to be identical, you can actually condense this shorthand further and just simply say border and then give it the properties that you want. One important thing to remember about borders and that's that they do affect the overall width of an element. Border widths begin at the edge of padding widths and then extend…

Contents