Landscape mode in HTML

edited June 2014 in General Discussion

I have two pictures in my HTML activity. I want to do this:
  • Portrait: pictures are next to each other
  • Landscape: pictures are placed vertically (one below the other one)
I tried javascript and media queries, but it does'nt work. I thing my code was bad. 
Do you have any ideas ?

Thanks !!


  • I'm not sure what CSS you're using but the most simple CSS way to do it is:

    @media all and (orientation:portrait) {img display:inline; }
    @media all and (orientation:landscape) {img display:block; }
    so to have images displayed next to each other is: inline or on top of each other is block
    You may want to include image width by percentage depending how many inline images you want next to each other etc...

  • Thank you @tarmworthheat, it worked!
Sign In or Register to comment.