Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using this css to create a rounded container for my test site. It works well on a PC (it fills the correct width of the screen) but on a mobile phone, the screen displays a fixed width (about 1/3 of the total screen width). I have tried changing various of the css parameters but the mobile size remains the same! I have also checked tutorial sites for any clues, but to no avail. Can anyone suggest a way to resolve this?

The css I am using:
CSS
#RoundedContainer {
    max-width: 95%;
    width: 90%;
    margin: auto;
    margin-top: 10pt;
    font-family: Calibri;
    padding: 0.5em 1em 1em 1em;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    background-color: #ababab;
    background: -webkit-gradient(linear, left top, left bottom, from(#909090), to(#a0a0a0));
    background: -moz-linear-gradient(top, #909090, #a0a0a0);
    -moz-box-shadow: 5px 5px 10px rgba(0,0,0,0.3);
    -webkit-box-shadow: 5px 5px 10px rgba(0,0,0,0.3);
    box-shadow: 5px 5px 10px rgba(0,0,0,0.3);
}


TIA.

What I have tried:

I have tried changing various of the css parameters and have also checked tutorial sites for any clues.
Posted
Updated 10-Apr-16 0:21am

1 solution

You should make sure the page has a viewport meta tag for screen size. Add this to the head section just before your css link.

HTML
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
 
Share this answer
 
Comments
Member 1583963 11-Apr-16 4:38am    
Thanks - but my omission on the question - I already have that line in the header. Admittedly it was:
<meta name="viewport" content="width=device-width, initial-scale=1" /> but changing the scale to 1.0 made no difference.
Ovie Prince Tegaton 11-Apr-16 5:46am    
did you try using @media screen ()... to check the size of the device and set the max-width to 100% ?
Member 1583963 11-Apr-16 6:34am    
I have tried that - no change. As a test I tried resizing the PC browser screen (I am using "Edge") but it would not reproduce the mobile screen problem! I know I must be doing something wrong but it is not showing itself.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900