Lesson: HTML5 and CSS
Add Borders Around your Elements
CSS borders have properties like style
, color
and width
For example, if we wanted to create a red, 5 pixel border around an HTML element, we could use this class:
<style>
.thin-red-border {
border-color: red;
border-width: 5px;
border-style: solid;
}
</style>
Create a class called thick-green-border
that puts a 10-pixel-wide green border with a style of solid
around an HTML element, and apply that class to your cat photo.
Remember that you can apply multiple classes to an element by separating each class with a space within its class
attribute. For example:
<img class="class1 class2">
The content on this page is licensed under Attribution-ShareAlike 4.0 International. Original authors: freeCodeCamp, the content was modified.