Yahoo India Web Search

Search results

  1. www.w3schools.com › Css › css_marginCSS Margin - W3Schools

    CSS has properties for specifying the margin for each side of an element: margin-top. margin-right. margin-bottom. margin-left. All the margin properties can have the following values: auto - the browser calculates the margin. length - specifies a margin in px, pt, cm, etc. % - specifies a margin in % of the width of the containing element.

  2. Jun 20, 2024 · Syntax. The margin property may be specified using one, two, three, or four values. Each value is a <length>, a <percentage>, or the keyword auto. Negative values draw the element closer to its neighbors than it would be by default. When one value is specified, it applies the same margin to all four sides. When two values are specified, the ...

  3. Learn how to set the margins for an element using the CSS margin property, a shorthand for margin-top, margin-right, margin-bottom and margin-left. See examples, syntax, browser support and margin collapse.

    • no
    • CSS1
    • object .style.margin="100px 50px" Try it
    • CSS Margins. CSS margins are used to create space around the element. We can set the different size of margins for individual sides(top, right, bottom, left).
    • 1. If the margin property has 4 values: margin: 40px 100px 120px 80px; top = 40px 2. right = 100px 3. bottom = 120px 4. left = 80px. Example:
    • 2. If the margin property has 3 values: margin:40px 100px 120px; top = 40px. right and left = 100px. bottom = 120px. Example:
    • 3. If the margin property has 2 values: margin: 40px 100px; top and bottom = 40px; left and right = 100px; Example:
  4. css-tricks.com › almanac › propertiesMargin | CSS-Tricks

    Sep 5, 2011 · Learn how to use the margin property to create space around an element, outside of any borders. Find out how to set margins using lengths, percentages, auto, and how to deal with collapsing margins and negative margins.

  5. Aug 24, 2023 · Learn how to use CSS margin properties to create space around an element and separate it from other elements. See examples of margin values, syntax and shorthand property.

  6. People also ask

  7. Jan 23, 2020 · Learn the basics of CSS margins, how they affect the layout and spacing of elements, and how to deal with common issues like collapsing margins and user-agent styles. This article explains margins with examples, diagrams, and code snippets.

  1. People also search for