• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » Css » Tutorial » CSS margin property
Next →
← Prev

CSS margin property

By Dinesh Thakur

Unlike padding property, the margin property puts space outside the box, between the box and other neighboring elements or between the box and the browser window. The values that can be set for this property can be specified in terms of length, percentage or AUTO.

For example:     P{border-style : solid;  Margin : 10px;  }

On specifying, it will put a solid border around <p> element in your webpage such that amount of space between border’s outer edge and any other element on any side of border is 10 pixels.

You can also set the margins for specific sides using MARGIN-TOP, MARGIN-RIGHT MARGIN-BOTTOM and MARGIN-LEFT properties. For examples:

P{border-style : solid;  MARGIN-TOP : 10px;  MARGIN-LEFT : 20px;  MARGIN-RIGHT : 15px;  }

Margin property is a shorthand property for MARGIN-TOP, MARGIN-RIGHT, MARGIN-BOTTOM and MARGIN-LEFT properties. You can set the margins for top, right. bottom and left sides in a single statement. The order in which these specified values will appear are margin values for top, right, bottom and left sides. For examples:

P{border-style : dotted;  Margin : 10px 0 0 30px;  }

You’ll also like:

  1. CSS font property
  2. CSS position property
  3. CSS padding property
  4. CSS background property
  5. CSS border-style property
Next →
← Prev
Like/Subscribe us for latest updates     

About Dinesh Thakur
Dinesh ThakurDinesh Thakur holds an B.C.A, MCDBA, MCSD certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps.

Dinesh Thakur is a Freelance Writer who helps different clients from all over the globe. Dinesh has written over 500+ blogs, 30+ eBooks, and 10000+ Posts for all types of clients.


For any type of query or something that you think is missing, please feel free to Contact us.


Primary Sidebar

CSS Tutorials

CSS Tutorials

  • CSS - Font Property
  • CSS - Background Property
  • CSS - CSS - Border-Style Property
  • CSS - Text-Decoration Property
  • CSS - Tables
  • CSS - Position
  • CSS - Syntax and Selectors
  • CSS - List
  • CSS - Margin
  • CSS - Padding

Other Links

  • CSS Tutorials - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW