Why html page isn't fit to 100%?

后端 未结 3 1565
不知归路
不知归路 2021-01-23 07:05

Whenever i want to make a html page i have problem with this, why html page is less than 100%? Let me explain in example:

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-23 07:23

    When you give display: inline-block; it generates spaces in-between them. Use the same code this way:

    Some text
    Some text
    Some text
    Some text
    Some text
    Some text
    Some text
    Some text
    Some text
    Some text

    Fiddle: http://output.jsbin.com/xorahifipe

    You can also use float: left, but you need to give overflow: hidden; to the parent, or clear it somehow. With your original example, float works this way:

    .row {
      width: 100%;    /* This is not necessary */
      margin: 0 auto; /* This is not necessary */
      padding: 0;     /* This is not necessary */
      overflow: hidden; 
    }
    .col-1 {
      width: 10%;
      margin: 0;      /* This is not necessary */
      padding: 0;     /* This is not necessary */
      float: left;
    }
    

    Fiddle: http://output.jsbin.com/daruzepiqa/1

提交回复
热议问题