search

Home  >  Q&A  >  body text

css - 为何我看到很多人写的自适应网页外容器都没有设置width,只有类似section {display: block; }?

迷茫迷茫2809 days ago871

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 12:07:52

    Block element width is 100%

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 12:07:52

    section is a new tag in HTML5, which represents a document section or section. This tag is used to make the code structure clearer and achieve semantic purposes; display:block; is used to define elements as block elements; block elements The default is to fill the entire line

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 12:07:52

    There are generally two methods

    • A method like bootstrap, which uses a container to set the width of the content area, and uses media queries to adapt to the screen. Then the content in the container is divided proportionally using row and col, so the section does not need a width,
      Another

    • The other is a full-screen layout, with no container or the container is 100% width
      A very important point for self-adaptation is not to specify the width of internal elements, because if the width is specified, it cannot be adapted.

    reply
    0
  • Cancelreply