Go Back   The macosxhints Forums > iHardware Devices > iPad Info Center



Reply
 
Thread Tools Rate Thread Display Modes
Old 11-10-2012, 01:07 PM   #1
paldo
Triple-A Player
 
Join Date: Dec 2006
Location: Switzerland
Posts: 174
homepage to fit into ipad screen:how?

I'm trying to make my homepage ipad friendly. As all pages of my site have long text, I want to fit my page into the screen so that there is no horizontal scrolling bar. Following some advise from the internet the page layout should be 750px wide (the ipad screen is 768px). My friend checked it on an ipad 3rd generation, but the result is not what I'm expecting. My page does not fill out the screen, only partially. Can someone tell me why and what I have to do? Thank you in advance.

Here an example of the page to test:

http://www.cspm-study-help.info/test750px.html

And here my CSS code:

Code:
<style type="text/css">

body{
	font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;	/* Font to use */
	
	font-size:12px;
	
	
}
#content {
  width: 750px ;
  margin-left: auto ;
  margin-right: auto ;
  border:1px solid;
  border-color:#CCCCCC;
  padding-left:4px;
}

table, td, th td
{

	


padding-left:10px;
padding-right: 10px;
font-size: 12px;
text-align:left;



}

.Q{	/* Styling question */
	/* Start layout CSS */
	color:#FFF;
	font-size:12px;
	background-color:#317082;
	width:740px;
	margin-bottom:2px;
	margin-top:2px;
	padding-left:2px;
	padding-right:2px;
	background-image:url('images/bg_answer.gif');
	background-repeat:no-repeat;
	background-position:top right;
	

	/* End layout CSS */

	overflow:hidden;
	cursor:pointer;
}
.A{	/* Parent box of slide down content */
	/* Start layout CSS */
	border:1px solid #317082;
	background-color:#E2EBED;
	width:740px;
	padding-left:1px;
	padding-right:1px;
	

	/* End layout CSS */

	visibility:hidden;
	height:0px;
	overflow:hidden;
	position:relative;

}
.A_content{	/* Content that is slided down */
	padding:1px;
	font-size:12px;
	position:relative;
}

</style>
<script type="text/javascript">
paldo is offline   Reply With Quote
Old 11-10-2012, 05:56 PM   #2
acme.mail.order
League Commissioner
 
Join Date: Sep 2003
Location: Tokyo
Posts: 6,045
The magic Google search terms you are looking for are `css @media ipad` and `viewport ipad`
acme.mail.order is offline   Reply With Quote
Old 11-10-2012, 07:39 PM   #3
mark hunte
MVP
 
Join Date: Apr 2004
Location: Hello London Calling
Posts: 1,787
Quote:
Originally Posted by acme.mail.order
The magic Google search terms you are looking for are `css @media ipad` and `viewport ipad`

Very handy.

Just inserting
</ meta name="viewport" content="width=device-width" /> 


Adjust the page width.

This may help me with an issue I am having.

Thanks acme.mail.order
__________________
MH.
mark hunte is offline   Reply With Quote
Old 11-11-2012, 10:18 AM   #4
mclbruce
Hall of Famer
 
Join Date: Mar 2002
Posts: 3,870
What happens if you remove, or comment out, all references to width? Or try width=auto or width=100%

Last edited by mclbruce; 11-11-2012 at 10:26 AM.
mclbruce is offline   Reply With Quote
Old 11-11-2012, 10:31 AM   #5
paldo
Triple-A Player
 
Join Date: Dec 2006
Location: Switzerland
Posts: 174
Quote:
Originally Posted by mclbruce
What happens if you remove, or comment out, all references to width? Or try width=auto or width=100%

Yes, I put it to auto and it works an ipad. I'm now looking to fix it for the iphone, the actual CSS is not iphone friendly.

http://www.cspm-study-help.info/test750px.html

Here the CSS that works on ipad but not on iphone:
Code:
****** name="viewport" content="width=device-width" />

<style type="text/css">

body{
	font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;	/* Font to use */
	
	font-size:12px;
	
	
}
#content {
  width: auto ;
  margin-left: auto ;
  margin-right: auto ;
  padding-left:4px;
  padding-right:4px;
}

table, td, th td
{

	


padding-left:10px;
padding-right: 10px;
font-size: 12px;
text-align:left;



}

.Q{	/* Styling question */
	/* Start layout CSS */
	color:#FFF;
	font-size:12px;
	background-color:#317082;
	width:auto;
	margin-bottom:2px;
	margin-top:2px;
	padding-left:2px;
	padding-right:2px;
	background-image:url('images/bg_answer.gif');
	background-repeat:no-repeat;
	background-position:top right;
	

	/* End layout CSS */

	overflow:hidden;
	cursor:pointer;
}
.A{	/* Parent box of slide down content */
	/* Start layout CSS */
	border:1px solid #317082;
	background-color:#E2EBED;
	width:auto;
	padding-left:1px;
	padding-right:1px;
	

	/* End layout CSS */

	visibility:hidden;
	height:0px;
	overflow:hidden;
	position:relative;

}
.A_content{	/* Content that is slided down */
	padding:1px;
	font-size:12px;
	position:relative;
}

</style>
Any good hints?
paldo is offline   Reply With Quote
Old 11-11-2012, 02:17 PM   #6
mclbruce
Hall of Famer
 
Join Date: Mar 2002
Posts: 3,870
HTML is supposed to adapt to all page sizes by default. You shouldn't need any tags at all specifying width.

try getting rid of all of your width: auto tags

also, try getting rid of the viewport meta tag
mclbruce is offline   Reply With Quote
Old 11-12-2012, 03:50 AM   #7
paldo
Triple-A Player
 
Join Date: Dec 2006
Location: Switzerland
Posts: 174
Quote:
Originally Posted by mclbruce
HTML is supposed to adapt to all page sizes by default. You shouldn't need any tags at all specifying width.
try getting rid of all of your width: auto tags also, try getting rid of the viewport meta tag

With evidence your suggestion without viewport and width is the best. Thank you.

Paldo
paldo is offline   Reply With Quote
Old 11-12-2012, 05:19 PM   #8
mclbruce
Hall of Famer
 
Join Date: Mar 2002
Posts: 3,870
You are welcome. You can also use percentages in your margins/padding instead of px. Percentages will translate better across different page sizes.

Back in the days before CSS I would just put everything in a table, surpress displaying the table borders, and declare the width of the table at 80 percent or so.
mclbruce is offline   Reply With Quote
Old 12-06-2012, 06:26 AM   #9
dripfeed
Registered User
 
Join Date: Dec 2012
Posts: 2
For iPhone 4 (which is smaller than iPhone 5) the view port width is 320. Vou might consider creating a single liquid site layout to suite all mobile devices instead of creating one for each and every device.
dripfeed is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 03:35 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.