Click here to Skip to main content
15,903,385 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello

for responsive web site i write bellow lines in a css file for masterpage (file site.css)

sometimes command:
width: auto;

work probably but sometimes no. why?

.page
{
/* width: 960px; */
width: auto;
background-color: #fff;
margin: 20px auto 0px auto;

/*border: 1px solid #496077;*/
}


thanks

What I have tried:

i don't know any things for do.


help
Posted
Updated 2-Nov-18 10:41am
Comments
Vincent Maverick Durano 2-Nov-18 16:39pm    
what specific scenarios where it does not work? What type/version of browsers did you test it?
Afzaal Ahmad Zeeshan 2-Nov-18 18:37pm    
One main thing to note here is that auto means that it will automatically fill all the space available inside the parent. It does not guarantee responsiveness.

As Vincent speaks in Solution 1, there are more techniques than this to apply responsiveness.

Lastly, consider using Bootstrap, they have done all the hard work for you. Unless, you want to learn the responsiveness, reinventing the wheel is not useful.

1 solution

Perhaps you should try looking into some options for implementing a responsive design. Check this article out: Common Approaches to Responsive Design[^]
 
Share this answer
 
v2

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