Thursday 27 January 2011

Setting the initial screen scaling in iPhone, iPod and iPad

To try and force the contents of a page to fit the width of an iPhone, iPod touch or iPad screen rather than scale the view to fit the window, add the following to the head section of an html page

<meta name="viewport" content="width=device-width" >

Friday 7 January 2011

Centering divs etc in CSS

Most objects in an html file can be centred using CSS simply by giving it a width and setting the margins to auto.

eg
.centered {
width: 80%;
margin-left:auto;
margin-right:auto;
}