Skip navigation
KaylaMW92
Currently Being Moderated

Issues with the width of my page!

Apr 27, 2012 7:36 AM

Hi guys, first off I apologize if this wasn't posted in the correct forums.

 

Well, I am designing my first mobile website.  I am trying to make the width adjust to the individual screen size 100%.  My main background is just fine obviously, however both my header and content DIV's will not stretch out, according to the Feature Phone preview (in the dropdown of Multiscreen preview) and in Device Central.  However, the strange thing is that if I view it in Multiscreen Preview or in Firefox, it's just fine.  I also don't see a problem within my code, where I have set the width of both to 100%.  I am not sure what is going on with this.

 

 


#header {

background:#CCC;

text-align:center;

width:100%;


}





#content {

background-image:url(images/bg.jpg);

background-repeat:repeat-x;

background-color:#6392C0;

width:100%;

text-align:center;


}

 

This it my HTML code for these DIV's.

 

issue.png  Here is the image viewed in the Feature Phone.  It also looks the same in Device Central.

 

issue2.png  And here it is in Multiscreen Preview.  The width is fixed just fine in both this preview and in Firefox.

 

Any ideas? Thanks in advance!

 
Replies
  • Currently Being Moderated
    Apr 27, 2012 8:27 AM   in reply to KaylaMW92

    Any ideas?

     

    Not really.

     

    You would need to upload the page and give us the link (preferred) or post the entire code of the page for us to be of much assistance.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 27, 2012 9:12 AM   in reply to KaylaMW92

    Go to "Code View" in Dreamweaver, select all from that window, copy and then paste in your post. If your CSS is on a separate file, you will also need to copy and paste the full CSS code.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 27, 2012 9:25 AM   in reply to KaylaMW92

    You need to post it in the forum, not by email.

     

    You can also try posting it using the Syntax highlight feature under Advanced editor in the forum. (top right corner on reply box)

    Then, use the double arrow > Syntax highlighting > Plain.

    Adobe_syntaxhighlight.jpg

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 27, 2012 9:41 AM   in reply to KaylaMW92

    You don't require the extra closing </div> below....other than that I can't see anything else wrong with the code.

     

     

    </div>

    </body>
    </html>

     

     

    Unless there is something else in this file which you are not showing us?

     

    css/mtemp.css

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 27, 2012 9:50 AM   in reply to KaylaMW92

    The problem is your image margin. Your total margin width plus image width exceeds the view width. Change your CSS to the below:

    #content img {
              margin:30px;

              margin:30px auto;/* 30px margin top/bottom, auto margin left/right*/

              display:block;
            }

     

    And also remove the additional closing </div> as OS has mentioned.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 27, 2012 10:01 AM   in reply to Rik Ramsay

    Good spot 266px as opposed to 240px.

     

    I guess to preserve the 30px either side of the image IF its critical set the:

     

    #content img {

    max-width: 100%;

    margin: 30px;

    }

     

    and delete the width and height. That will give you a scalable image, which may look better on mobile.

     

     

    <p><img src="images/box.png"/></p>

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points