Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Aligning Div

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #40966
    Rohithzr
    Participant

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

    #115323
    pmac627
    Participant

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

    X
    X

    #115324
    Rohithzr
    Participant

    on top of each other……..

    #115325
    Rohithzr
    Participant

    like two divs having same coordinates

    #115328
    pmac627
    Participant

    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

    #115329
    pmac627
    Participant

    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.

    #115327
    Paulie_D
    Member

    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.

    #115386
    Rohithzr
    Participant

    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….

    #115402
    jwebcat
    Member

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

    #115403
    jwebcat
    Member

    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.

    #115404
    Paulie_D
    Member

    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.

    #115417
    Rohithzr
    Participant

    @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…..

    #115419
    Rohithzr
    Participant

    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

    #115421
    Paulie_D
    Member

    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?

    #115422
    Rohithzr
    Participant

    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)
  • The forum ‘CSS’ is closed to new topics and replies.