Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying differently for the iPhone, how? 1

Status
Not open for further replies.

hitsuin

Vendor
Aug 23, 2010
24
GB
Hello everyone, I want to write a website that stays the same in normal browsers but displays differently for the iPhone. The same way gmail does, like it is loading a different html file. Does any one know how to do that?
 
You can use specific CSS for the iPhone, by using the media specification.

You can have a set of CSS rules that will only apply to the iPhone smaller screen:

Code:
@media only screen and (max-device-width: 480px) {
  .navigation {
    display: none;
  }
}

Alternatively you can use Javascript to check for the specific browser by using browser detection, an then simply redirect to a site that's nice and small for the iphone screen.

Basically you design your site with a 480px screen in mind.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top