Tech > CssTips

CssTips

Centring a DIV

Set the left and right margins of the DIV to be centred to 'auto'. E.g.

#my_div {
    margin: 5px auto 5px auto;
}

To work with some versions of IE the containing DIV needs also to have a text-align: center

Removing Image Borders

Where an image is wrapped with an <a> tag a border is usually displayed so that the user knows the image is clickable. To disable that behviour, add the following to your style sheet:

a:link img, a:visited img, a:hover img, a:active {
    border-style: none;
}

References

-- Frank Dean - 04 Jun 2009

Related Topics: HtmlHintsAndTips