How to auto adjust the div size for all mobile / tablet display formats?

后端 未结 9 975
一个人的身影
一个人的身影 2020-12-07 11:36

I have designed a page where four div tags are there in the page. If I test the page in mobile phone (5 inch) it fits the page perfectly, If I test the same pag

9条回答
  •  既然无缘
    2020-12-07 12:22

    I don't have much time and your jsfidle did not work right now.
    But maybe this will help you getting started.

    First of all you should avoid to put css in your html tags. Like align="center".
    Put stuff like that in your css since it is much clearer and won't deprecate that fast.

    If you want to design responsive layouts you should use media queries wich were introduced in css3 and are supported very well by now.

    Example css:

    @media screen and (min-width: 100px) and (max-width: 199px)
    {
        .button
        {
            width: 25px;
        }
    }
    
    @media screen and (min-width: 200px) and (max-width: 299px)
    {
        .button
        {
            width: 50px;
        }
    }
    

    You can use any css you want inside a media query.
    http://www.w3.org/TR/css3-mediaqueries/

提交回复
热议问题