Forums

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

Home Forums CSS Align 3 elements in css

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #196724
    m0j1
    Participant

    I have 3 elements which I want to align in my html file. the first image just has a left margin and is vertically centered. the middle element is vertically and horizontally centered and the third element has right margin and is vertically centered.
    can independently align elements horizontally and vertically with below code :

    #element{
    height : 40%;
    position : relative;
    left : 50%;
    top : 50%;
    transform : translate(-50%,-50%);
    }

    but when it comes to align elements along each other they don’t place correctly.
    I’ll appreciate if you can help me with this.
    Thanks very much

    #196726
    Paulie_D
    Member

    It’s not quite clear to me what you are after…could you make a Codepen.io demo?

    #196727
    m0j1
    Participant

    I’m trying to achieve something like this. where the orange background itself is a div which contains the 3 elements : http://imgur.com/UwFhNc4

    #196783
    Paulie_D
    Member
    #196921
    m0j1
    Participant

    I managed to solve it by using a container for each of the elements. I have wrote the codes in cssdesk here :
    http://www.cssdesk.com/Z98q3
    The strange thing is that it works on different browsers in desktop and mobile. But I want to use it in my Android webview application, and when I use it there in android 4.4+ devices , the positions of the elements are not correct. I know there has been some changes in android kitkat’s webview but migration documents also didn’t help me.
    I’ll appreciate if you can help me with this.
    Thanks very much

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.