Grow your CSS skills. Land your dream job.

Aligning Div

  • # November 24, 2012 at 10:51 am

    I want to place 1 div on another ………. [like div1 on top of div2] is i possible?

    # November 24, 2012 at 10:54 am

    Like, overlaying (think two pieces of paper stacked on top of each other? Or two over each other like below?

    X
    X

    # November 24, 2012 at 11:02 am

    on top of each other……..

    # November 24, 2012 at 11:03 am

    like two divs having same coordinates

    # November 24, 2012 at 11:34 am

    There are a bunch of ways to do it. There are some better than this, but this works:

    http://codepen.io/Pmac627/pen/GshgA

    I have them not completely overlaying to show that there are two elements there. Just adjust the left and top values

    # November 24, 2012 at 11:35 am

    Its very possible. If you want faster replies, google the question. You can find dozens of possible solutions to the multiple questions you’ve asked on these forums over the last hour.

    # November 24, 2012 at 1:59 pm

    The more important question is WHY you want to do this?

    From previous posts of the OP it seems like s/he hasn’t really gotten to grips with the basics as yet.

    # November 25, 2012 at 2:13 am

    i am an amateur of course…………. actually i am learning css widout books, tutorials etc.. i dont hav access to them ..nor internet (except today) so just want to clear a few doubts as i hav a net connection today….

    # November 25, 2012 at 4:04 am

    learn about z-index and position. Google them one at a time.

    # November 25, 2012 at 4:06 am

    div1 {
    position: relative;
    z-index:1
    }
    div2 {
    position:relative;
    z-index:2
    }

    the highest z-index is on the top. You have to have a position declared for it to work.

    # November 25, 2012 at 4:07 am

    As I said, we’d need to know WHY this is to be done.

    What effect are you trying to achieve?

    You said, elsewehere

    >i am new at css and know all the shadowing, rotating etc

    I suspect you might have been overstating your skills here plus there seems to be a contraction inherent in that statement.

    # November 25, 2012 at 5:05 am

    @jwebkat thanx a lot ……. thats wat i needed…….

    @Paulie_D may u r rite as i thot that i know everything about those stuff ….. but i guess i was wrong…… as i said theres no one to guide or even hint me….
    watever i am, i am the best at ma skul…… so it’s kind of hard for me to know about thing …. so wenever i get time on net i just download as many webpages/ tutorials as i can and read various forums……. this forum has been the best for me…. it would surely help me learn…..

    # November 25, 2012 at 5:08 am

    talking about the effect … i actually wanted a 0.5 opacity background but 1 opacity text….. i placed it as position absolute but didnt really work with changing screen sizes …. so i wanted a relatively sized and positioned divs…. hope i make a bit sense

    # November 25, 2012 at 5:14 am

    Depending on what your background is you might not need the extra div.

    If it’s a color, you can set the color using rgba and apply an opacity that way.

    We’d need to see what it is you are trying to do…can you provide us with an image?

    # November 25, 2012 at 5:22 am

    well just tried and it worked both the ways……. man u people are brilliant
    it was both [image at places and color at other places]
    really really thank you

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".