2010-10-19 17 views
10

पर देखे जाने पर वेबसाइट पर divs के बीच स्थान/अंतराल मुझे आईफोन और आईपैड पर देखे जाने पर मेरी वेबसाइट को सही तरीके से प्रदर्शित करने में कुछ कठिनाई हो रही है। वेबिस्ट (समाप्त होने के करीब भी नहीं) www.lzkconcepts.com है।आईफोन/आईपैड

आईफोन/आईपैड पर मैंने जो भी डेस्कटॉप ब्राउज़र (सफारी, क्रोम, फ़ायरफ़ॉक्स, आईई) पर देखा है, वेबसाइट ठीक से प्रदर्शित होती है, हालांकि "सामग्री" div और हेडर के बीच एक छोटा अंतर/स्थान होता है और पाद लेख। मैं पृष्ठ की रूपरेखा बनाने के लिए शीर्षलेख, सामग्री और पाद लेख divs में पृष्ठभूमि छवि का उपयोग कर रहा हूं। Divs के बीच अंतराल के अलावा, सामग्री पृष्ठभूमि छवि कभी-कभी "संकीर्ण" होती है, ताकि यह स्क्रीन के दाईं ओर शीर्षलेख और पाद लेख के साथ लाइन न हो। अगर मैं ज़ूम इन करता हूं, तो सबकुछ पूरी तरह से बढ़ता है। यहाँ एक स्क्रीनशॉट iPhone से लिया ... नीले नेविगेशन पट्टी के नीचे दाईं ओर

http://s1139.photobucket.com/albums/n545/lhkimbrough/?action=view&current=7198e49b.jpg&evt=user_media_share

देखो बारीकी से है।

यहाँ सीएसएस (मैं जानता हूँ कि यह बहुत ही किसी न किसी तरह है, मैं सिर्फ सीख रहा हूँ)

@charset "UTF-8"; 
body { 
margin: 0; 
padding: 0; 
color: #000; 
font-family: Arial, Helvetica, sans-serif; 
font-size: 100%; 
line-height: 1.4; 
background-color: #CCC; 
} 
.TableAppName { 
color: #007EB4; 
} 

/* ~~ Element/tag selectors ~~ */ 
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */ 
padding: 0; 
margin: 0; 
} 
h1, h2, h3, h4, h5, h6, p { 
margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */ 
padding-right: 15px; 
padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */ 
} 
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */ 
border: none; 
} 
/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */ 
a:link { 
color: #42413C; 
text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */ 
} 
a:visited { 
color: #6E6C64; 
text-decoration: underline; 
} 
#h-navbar { 
font-size: 95%; 
background-color: #CCC; 
background-image: url(images/navBarBlue.png); 
background-repeat: no-repeat; 
text-align: right; 
padding-right: 20px; 
color: #FFF; 
height: 39px; 
padding-top: 6px; 
} 
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */ 
text-decoration: none; 
} 

/* ~~ this fixed width container surrounds the other divs ~~ */ 
.container { 
width: 874px; /* the auto value on the sides, coupled with the width, centers the layout */ 
margin-top: 0; 
margin-right: auto; 
margin-bottom: 0; 
margin-left: auto; 
background-color: #CCC; 
} 

/* ~~ the header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo ~~ */ 
.header { 
background-color: #CCC; 
background-image: url(images/BannerFadedBlueAndOrangeText.png); 
background-repeat: no-repeat; 
height: 165px; 
} 

/* ~~ This is the layout information. ~~ 

1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design. 

*/ 

.content { 
background-color: #CCC; 
background-image: url(images/contentFadedDark4.png); 
background-repeat: repeat-y; 
padding-left: 15px; 
} 
.contentBottom { 
padding: 0px; 
margin: 0px; 
} 

/* ~~ The footer ~~ */ 
.footer { 
background-color: #CCC; 
background-image: url(images/FooterFadedDark.png); 
background-repeat: no-repeat; 
text-align: right; 
font-size: 80%; 
} 

/* ~~ miscellaneous float/clear classes ~~ */ 
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ 
float: right; 
margin-left: 8px; 
} 
.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */ 
float: left; 
margin-right: 8px; 
} 
.clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the #footer is removed or taken out of the #container */ 
clear:both; 
height:0; 
font-size: 1px; 
line-height: 0px; 
} 
#h-navbar a, #h-navbar a:visited { 
text-decoration: none; 
color: #FFF; 
} 
#h-navbar a:hover { 
color: #ea6828; 
} 
.footer p { 
color: #0075A7; 
} 
.content h1 { 
color: #0074A9; 
font-weight: normal; 
font-size: 200%; 
font-style: normal; 
padding-top: 15px; 
padding-left: 23px; 
} 
.graytext { 
color: #333; 
} 

है और यहाँ है एचटीएमएल

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/LZKConcepts_Template.dwt" codeOutsideHTMLIsLocked="false" --> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<!-- InstanceBeginEditable name="doctitle" --> 
<title>LZK Concepts</title> 
<!-- InstanceEndEditable --> 
<link href="LZKConcepts_styles.css" rel="stylesheet" type="text/css" /> 
<!-- InstanceBeginEditable name="head" --> 
<!-- InstanceEndEditable --> 
</head> 

<body> 

<div class="container"> 
    <div class="header"><!-- end .header --></div> 
    <div id="h-navbar"><a href="index.html"> Home </a> | <a href="#"> QuickGrader </a> | <a href="#"> Wish On A Star </a> | <a href="AboutUs.html"> About Us </a> | <a href="#"> Contact Us </a></div> 
    <!-- InstanceBeginEditable name="MainContent" --> 
    <div class="content"> 
    <h1> 
     <!-- end .content --> 
    iPhone Apps</h1> 
    <table width="844" border="0"> 
     <tr> 
     <td width="160" rowspan="2" valign="top"><a href="#"><img src="images/QuickGraderIconReflected140.png" alt="QuickGrader" width="120" height="154" hspace="20" /></a></td> 
     <td width="482" class="TableAppName">QuickGrader</td> 
     <td width="188">&nbsp;</td> 
     </tr> 
     <tr> 
     <td height="127" valign="top" class="graytext">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris neque quam, facilisis sed iaculis tempor, iaculis vitae purus. Mauris eros lacus, commodo ut feugiat vel, sollicitudin et elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur urna diam, iaculis ut commodo molestie, congue non lacus. </td> 
     <td align="right" valign="top"><br /> 
     <a href="http://itunes.apple.com/app/quickgrader/id392532471?mt=8" target="_new"><img src="images/App_Store_Badge.png" alt="AppStore" width="155" height="54" hspace="18" vspace="0" align="right" /></a></td> 
     </tr> 
    </table> 
    <p>&nbsp;</p> 
    <table width="844" border="0"> 
     <tr> 
     <td width="160" rowspan="2" valign="top"><a href="#"><img src="images/Wish On A Star Reflected.png" alt="QuickGrader" width="120" height="154" hspace="20" /></a></td> 
     <td width="482" class="TableAppName">Wish On A Star</td> 
     <td width="188">&nbsp;</td> 
     </tr> 
     <tr> 
     <td height="130" valign="top">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris neque quam, facilisis sed iaculis tempor, iaculis vitae purus. Mauris eros lacus, commodo ut feugiat vel, sollicitudin et elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur urna diam, iaculis ut commodo molestie, congue non lacus. </td> 
     <td align="right" valign="top"><br /> 
      <a href="http://itunes.apple.com/app/wish-on-a-star/id366753945?mt=8" target="_blank"><img src="images/App_Store_Badge.png" alt="AppStore" width="155" height="54" hspace="18" align="right" /></a></td> 
     </tr> 
    </table> 
    <p>&nbsp;</p> 
    <table width="844" border="0"> 
     <tr> 
     <td width="160" rowspan="2" valign="top"><a href="#"><img src="images/Wish On A Star Free Reflected.png" alt="QuickGrader" width="120" height="154" hspace="20" /></a></td> 
     <td width="482" class="TableAppName">Wish On A Star Free</td> 
     <td width="188">&nbsp;</td> 
     </tr> 
     <tr> 
     <td height="130" valign="top">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris neque quam, facilisis sed iaculis tempor, iaculis vitae purus. Mauris eros lacus, commodo ut feugiat vel, sollicitudin et elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur urna diam, iaculis ut commodo molestie, congue non lacus. </td> 
     <td align="right" valign="top"><br /> 
      <a href="http://itunes.apple.com/app/wish-on-a-star-free/id388860624?mt=8"><img src="images/App_Store_Badge.png" alt="AppStore" width="155" height="54" hspace="18" align="right" /></a></td> 
     </tr> 
    </table> 
    </div> 
    <!-- InstanceEndEditable --> 
    <div class="footer"> 
    <p><br /> 
<br /> 
     <br /> 
    Copyright © 2010, LZK Concepts. All rights reserved.</p> 
</div> 
    <!-- end .container --></div> 
</body> 
<!-- InstanceEnd --></html> 

किसी को भी एक विचार है क्यों iPhone और iPad प्रदान कर रहे हैं इस तरह का पेज?

+1

+1 - यह सिर्फ आईपैड पर नहीं देखा है, लेकिन अन्य ब्राउज़र जो पूर्ण पृष्ठ ज़ूम करते हैं। आईपैड पर आईएनजी बैंक साइट के फ्रंट पेज पर प्रभाव देखने के बाद इस पर खोज करने के लिए हुआ। –

उत्तर

13

आईपैड पर, जब कोई वेबसाइट 100% से कम पैमाने पर देखी जाती है, तो कुछ कलाकृतियों कभी-कभी दिखाई देती हैं। एक विशेष रूप से दृश्यमान है: मेनू के नीचे, आपकी साइट पर जैसे divs के बीच एक पिक्सेल लाइनें।

मुझे मिला समाधान मुझे divs के बीच "मार्जिन: -1px" जोड़ना है। Divs पृष्ठभूमि 1 पिक्सेल के साथ ओवरलैप, और यदि स्लाइसिंग तदनुसार किया जाता है, तो क्लासिक ब्राउज़र के लिए यह अदृश्य है, और आईपैड पर समस्या को ठीक करता है।

+4

यह शर्म की बात है कि हमें ब्राउज़र के लिए इन सभी हैक्स का उपयोग करना होगा :-(मानकों को और अधिक सम्मानित करने की आवश्यकता है। – Bojangles

+0

मैं पूरी तरह से आपसे सहमत हूं! लेकिन दूसरी ओर, यह बिना किसी वेब पेज को स्केल करना इतना आसान नहीं होना चाहिए कुछ अजीब चीजें अब और फिर ... – plang

+0

प्लैंग से ग्रेट वर्कअराउंड, जिसने मेरे लिए भी इस मुद्दे को हल किया! बस सोच रहा है कि "स्केलिंग कलाकृतियों" से बचने के लिए कोई दूसरा, कम "हैक-वाई" तरीका है – pvandenberk

3

उपयोग:

meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" 
जब एक वेबसाइट एक गोली या अन्य डिवाइस पर प्रदर्शित किया जा रहा है के लिए

। आपको दिखाई देने वाले पिक्सेल अंतर से छुटकारा पाना चाहिए। साइट्स को अधिकतम क्रॉस डिवाइस एक्सेस के लिए इन दिनों अर्थात् स्केलेबल डिज़ाइन किया जाना चाहिए।

मेरे लिए, यदि मैं बिल्कुल काम करने की ज़रूरत है तो मैं आमतौर पर एक PHP डिवाइस डिटेक्टर का निर्माण करता हूं। इस प्रश्न के लिए