- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Usage of margin-top property with CSS
The margin-top specifies the top margin of an element. It can have a value in length, % or auto.
Example
You can try to run the following code to set the top margin
<html> <head> </head> <body> <p style = "margin-top: 10px; border:2px solid red;"> This is a paragraph with a specified top margin </p> <p style = "margin-top: 10%; border:2px solid green;"> This is another paragraph with a specified top margin in percent </p> </body> </html>
- Related Articles
- Usage of margin property with CSS
- Usage of margin-bottom property with CSS
- Usage of margin-right property with CSS
- Usage of border-top-color property in CSS
- Usage of border-top-style property in CSS
- Usage of border-top-width property in CSS
- Set the top margin of an element with CSS
- Usage of transform property with CSS
- Usage of border property with CSS
- Usage of width property with CSS
- Usage of height property with CSS
- Animate CSS margin property
- Role of margin property with value inherit using CSS
- Role of margin property with value auto using CSS
- Usage of transform-origin property with CSS

Advertisements