html - Divs to go vertical on mobile sites -
so, have 3 divs go horizontal on webpage. however, when accesses site on mobile device don't want user have scroll left/right view divs. here simple code using @ minute. using opera mobile emulator view site on mobile.
http://imgur.com/erfwr1i happens on mobile devices.
<html> <head> <style> @-o-viewport{ width:device-width; zoom:1; } </style> </head> <body> <div style = "width:100%"> <div style = "width:30%; display:inline-block;"> <div> <img src="mario.png"> </div> <div> test </div> </div> <div style = "width:30%; display:inline-block;"> <div> <img src="mario.png"> </div> <div> test </div> </div> <div style = "width:30%; display:inline-block;"> <div> <img src="mario.png"> </div> <div> test </div> </div> </div> </body> </html>
use media queries:
<div class="con"> <div class="col"> <div> <img src="http://placekitten.com/200/300" /> </div> <div> test </div> </div> <div class="col"> <div> <img src="http://placekitten.com/200/300" /> </div> <div> test </div> </div> <div class="col"> <div> <img src="http://placekitten.com/200/300" /> </div> <div> test </div> </div> </div> @-o-viewport{ width:device-width; zoom:1; } .col { width:30%; display:inline-block; } .con { width:10)%; } /* 767 */ @media (max-width:767px) { .col { width:100%; display:block; } } you had error in html, sure close off img tags ().
Comments
Post a Comment