SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard subnet_rx's Avatar
    Join Date
    Aug 2001
    Location
    Hattiesburg, MS
    Posts
    1,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    vertically centering/anchor properties ?

    Ok, two CSS questions. Is it possible to have a paragraph or div with an image and text vertically centered inside that div with the image?

    Also, it's putting a blue border around all images that are links, why?

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,367
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    Well until the other day it was deemed impossible to vertically centre an element in another element of unknown height. However there is a solution in this thread that does just that:

    http://www.sitepoint.com/forums/show...vertical+align

    Whether its applicable to your problem you'll have to have a look and see

    If the elements have known height then there is a solution in the FAQ under how to vertically centre something by using top:50% and then a negative top margin of half the images height.

    You can vertically centre within a single line (or table cell) but not within a block element such as a div (except for the technique in the link above.) You can center a word or sentence that isn't going to wrap by setting the line-height to the same height as the div and the text will be centred. However IE won't do the same for images

    For the borders around images try using img {border:none}. You may have to make it more specific to the image in question.

    Hope that helps.

    Paul
    Edit:


    If its the anchor around the image that has the border then you need to address the anchors border properties instead of the images.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •