Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Thanked 0 Times in 0 Posts

    Getting an image to do what I need it to

    My site is at http://www.cerebral-coitus.com (nothing too bad, but it is nsfw)

    I have an image that I'd like to appear roughly like this: http://i.imgur.com/xSNHF.jpg

    The important thing is that it must go behind the header text, but on top of the grey content block.

    If the browser window is resized, it should also stay in the same place relatively to the header text.

    Can this be done?

    I'm a beginner with html and css.

    Thanks for any help!
    Last edited by cerebralc; 12-15-2012 at 09:44 PM. Reason: resolved

  2. #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Thanked 1,874 Times in 1,858 Posts
    Hello cerebraic,
    When you start putting elements on top of other elements, you will want to use absolute positioning and z-index.

    Look at it like this -
    <div class="content-outer">
      <img href="your/image.jpg" alt="description" id="newImage" />
    <div class="content-cap-top cap-top">
    <div class="cap-left"></div>
    <div class="cap-right"></div>
               .content-outer {position: relative;}
        #newImage {
          position: absolute;
          top: -10px;
          right: -10px;
          z-index: 1;
          /*for display only:*/
          height: 200px;
          width: 200px;
          display: block;
          background: #fc6;
    .Header h1 {
          position: relative;
          z-index: 2;
    Last edited by Excavator; 12-15-2012 at 05:37 PM.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use a DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  3. Users who have thanked Excavator for this post:

    cerebralc (12-16-2012)

  4. #3
    New to the CF scene
    Join Date
    Dec 2012
    Thanked 0 Times in 0 Posts
    Haha, I had no idea there was such a thing as z-index!

    Thank you very very much, that worked perfectly and its exactly what I wanted

    I especially appreciate the code examples, made putting everything in a breeze.

    The only thing I needed to change was the top margin, I tried it in FF, chrome and IE they all seemed to want -30.

    Thanks again man!


Posting Permissions

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