#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Overlapping two divs?


    Hi guys,

    Hope someone can help me out. I was wondering if it was possible to overlap two divs. Basically I have one div that is an image with some white space, that I'd like to move some text inside of. Is this possible with CSS?

    I know I can do this with photoshop and image manipulation but I'd rather keep the text as text for SEO purposes.

    Thanks for your help!
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    1
    Rep Power
    0
    Unfortunately, since I'm new, I can't post a URL with an example, but you can absolute position the text inside a parent div. I didn't use two divs, but here's a quick example.

    HTML
    Code:
    <div id="box">
        <img src="image_url" />
        <p>Hi</p>
    </div>
    CSS
    Code:
    #box{
        position:relative;
    }
    p {
        position:absolute;
        top: 0;
        left: 0;
    }
    The parent div has an id #box with relative positioning. Inside that div, I have an image and a paragraph. I just absolute positioned the paragraph over the image.

    You'll have to adjust the top/left values depending on where you want to position it.

IMN logo majestic logo threadwatch logo seochat tools logo