Grokking CSS for Web Development
Vote

0% completed

​

CSS Margin

How does the browser decide how far apart two cards sit on a page? The answer is the margin, the transparent space outside an element's border. A margin does not change the size of the element. Instead, it pushes neighboring elements, and the edge of the parent, away from it.

This lesson adds a second product card to the page and gives both cards a 300-pixel width, so you can see the space around each one.

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Product cards</title>

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content