CSS Padding Property Explained
This Blog You Will Learn
ஃWhat is Padding in CSS
ஃ Advantages of CSS Padding Property
ஃ Real -World Use
ஃ Why Use Padding
ஃ Syntax
ஃCSS Padding Property Example
ஃExplain Program
ஃ Output
Padding is css property creates space inside an element between the content and border
Advantages of CSS Padding Property
✅ Improves Readability
✅Enhances User Interface
✅Better User Experience(UX)
✅Prevents Content Overlap
✅Flexible Layout Control
- one Side
- Two side
- All four sides
✅Works With All HTML elements
- div
- P
- button
- a
- input
- section
Real -World Use
- Buttons (padding:10px 20px)
- Cards and boxes
- Navigation menus
- Forms and input fields
Why Use Padding
- Improves readability
- Creates Space around text
- Makes buttons,cards, and boxes look better
- prevents text from touching borders.
Syntax
CSS Padding Explained
- All Sides =20px
2) Two Values
- Top And Bottom =20px
- Left And Right = 30px
3) Three Values
- Top =10px
- Left& Right =20px
- Bottom =30px
- top→Right→Bottom→Left
CSS Padding Property Example
CSS Padding Property Explained
Explain Program
<!DOCTYPE html>
- This declare the document type.
- browser that the document is written in html
Step 2 ]
<html>.... . </html>
- html is the root element of the html page.
- Every thing inside it is part of the webpage.
Step 3]
Contains styles, metadata and page setting
Step 4]
- Add blue border around <div>
- 2px - Thickness
- solid - border style
- blue - border color
- Padding properties
- Padding creates space inside element between content (text) and border
1) padding-top: 30px;
- Add 30pixels of space above content
- Push the text downward
- Creates Breathing space between text and top border
- Adds 30pixels of space below content.
- Push the bottom border away from the text
- space appears under the text
- Add 80pixels of space on the right side
- largest padding
- Extra Space on the right side of the text
- Add 50Pixels of space on the left side.
- Pushes text towards the right
CSS Padding Property Explained
No comments:
Post a Comment