How to Remove a Div Margin

The "margin" CSS style lets you control the space between elements. You can use this CSS property in a div tag to control the position of other elements that surround the div tag. To remove a margin, you set the property to zero pixels. Zero pixels tells the browser not to pad any space between the div and other images or text.

Instructions

    • 1

      Right-click the HTML file you want to edit and select "Open With." Click your HTML editor in the sub-menu.

    • 2

      Locate the div you want to edit on your page. If the div already has a margin set, you must edit it. If the div does not have a "style" property set for the margin, you can add it.

    • 3

      Set the margin to zero pixels to remove it. The following is an example of a div tag that has no margin set:

      <div id="mydiv" style="margin: 0px"> My content. </div>

Related Searches:

References

Comments

Related Ads

Featured