Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-15-2012, 10:10 AM   PM User | #1
cerebralc
New to the CF scene

 
Join Date: Dec 2012
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
cerebralc is an unknown quantity at this point
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
cerebralc is offline   Reply With Quote
Old 12-15-2012, 05:34 PM   PM User | #2
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
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 -
Code:
</div>
</div>
<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>
</div>
Code:
           .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;
    }
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

Last edited by Excavator; 12-15-2012 at 05:37 PM..
Excavator is offline   Reply With Quote
Users who have thanked Excavator for this post:
cerebralc (12-16-2012)
Old 12-15-2012, 09:43 PM   PM User | #3
cerebralc
New to the CF scene

 
Join Date: Dec 2012
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
cerebralc is an unknown quantity at this point
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!
cerebralc is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:55 AM.


Advertisement
Log in to turn off these ads.