1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Problem with Css not working with PHP [Negative margin]

Discussion in 'BlackHat Lounge' started by nisdee, Feb 14, 2015.

  1. nisdee

    nisdee Regular Member

    Joined:
    Nov 16, 2014
    Messages:
    353
    Likes Received:
    122
    Location:
    Rainbow Land
    So guys, I've been designing new website whole day, and just now I've connected SQL and everything with php, and BANG, css not working as intended...

    For example:

    #picture {position:absolute; left: 50%; top:235; margin-left: -465;}

    So in theory, left edge of the picture should go 50% from the left, and then come back to the left for 465px, and stay centered (pic. width is 930px, half=465)
    I really don't know any other way of centering pictures, so why is my negative margin not working, while everyting else is working fine? Any other way of centering?
     
  2. rob1977

    rob1977 Power Member

    Joined:
    Mar 25, 2013
    Messages:
    775
    Likes Received:
    676
    <div style="text-align: center;"><IMG SRC="image.gif" ALT="image"></div>
     
    • Thanks Thanks x 1
  3. tiyowan

    tiyowan Regular Member

    Joined:
    Aug 7, 2013
    Messages:
    250
    Likes Received:
    136
    Inspect the element in Chrome and figure out what other style is being applied to it and from where.

    Then, override that.
     
    • Thanks Thanks x 1
  4. nisdee

    nisdee Regular Member

    Joined:
    Nov 16, 2014
    Messages:
    353
    Likes Received:
    122
    Location:
    Rainbow Land
    Thanks, even tho I don't like working with text-align with images
     
  5. nisdee

    nisdee Regular Member

    Joined:
    Nov 16, 2014
    Messages:
    353
    Likes Received:
    122
    Location:
    Rainbow Land
    You, you just made my day huh :)
    Thanks a lot, I haven't really tought about inspecting element... Guess I shoulda start working with Dreamweaver so I don't make stupid mistakes....
    Once again thanks a lot! ;)