Making div content responsive

后端 未结 3 962
耶瑟儿~
耶瑟儿~ 2021-02-05 21:10

My content isn\'t responsive at the moment. I\'ve tested it on iPhone and the text goes over the screen.

I\'ve changed the CSS of my container to:

#conta         


        
相关标签:
3条回答
  • 2021-02-05 21:31

    Not a lot to go on there, but I think what you're looking for is to flip the width and max-width values:

    #container2 {
      width: 90%;
      max-width: 960px;
      /* etc, etc... */
    }
    

    That'll give you a container that's 90% of the width of the available space, up to a maximum of 960px, but that's dependent on its container being resizable itself. Responsive design is a whole big ball of wax though, so this doesn't even scratch the surface.

    0 讨论(0)
  • 2021-02-05 21:32

    try this css:

    /* Show in default resolution screen*/
    #container2 {
    width: 960px;
    position: relative;
    margin:0 auto;
    line-height: 1.4em;
    }
    
    /* If in mobile screen with maximum width 479px. The iPhone screen resolution is 320x480 px (except iPhone4, 640x960) */    
    @media only screen and (max-width: 479px){
        #container2 { width: 90%; }
    }
    

    Here the demo: http://jsfiddle.net/ongisnade/CG9WN/

    0 讨论(0)
  • 2021-02-05 21:35

    @media screen and (max-width : 760px) (for tablets and phones) and use with this: <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    0 讨论(0)
提交回复
热议问题