Grokking CSS for Web Development
0% completed
CSS Padding
The space between an element's content and its border is called padding. Margin keeps other elements away from the border; padding keeps the element's own text away from it. Without padding, the text of the product cards from the previous lesson touches their gray borders.
Here is the page from the margin lesson, with the cards centered and 16 pixels of padding added.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Product cards</title> <style> .card {
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%