CSS noob?

Out of context: Reply #3

  • Started
  • Last post
  • 4 Responses
  • Stugoo0

    could also.
    <div class="hold">
    <img>
    </div>

    .hold { width: 1000px; height :1000px; position:relative; }
    .hold img{ position : absolute; top : 50%; left:50%; width: 200px; height: 200px; margin : -100px 0 0 -100px; }

    seeing as your calling yourself a noob a couple of points to note:
    .hold can be any width/height.
    img is positioned absolutley, relative to .hold.
    with top/left values at 50%, the margin needs to be negative 50% of the width to offset it.

    hope this makes sense, im sans coffee.

View thread