Avoid an element to be split into two columns while using column-count

前端 未结 1 1304
南方客
南方客 2021-01-28 12:48
1条回答
  •  情深已故
    2021-01-28 13:02

    Use break-inside: avoid; (or the propriety equivalents) to prevent the tags from flowing into the next column:

    div.Nav {
      height: 100% !important;
    }
    
    div.Nav a.icon {
      position: absolute;
      right: 0;
      top: 0;
    }
    
    div.Nav a {
      transition: 0.5s;
      line-height: 25px;
      text-align: center;
      font-weight: lighter;
      color: black;
      padding: 8px 16px;
      text-decoration: none;
      font-size: 20px;
      float: none !important;
      display: block;
      text-align: left;
      
      -webkit-column-break-inside: avoid; /* Chrome, Safari, Opera */
      page-break-inside: avoid; /* Firefox */
      break-inside: avoid; /* IE 10+ */
    }
    
    div.Nav a.active {
      background-color: #4CAF50;
      color: white;
      cursor: default;
    }
    
    div.Nav a:hover:not(.active) {
      background-color: rgb(56, 62, 50);
      color: #fffd78;
      transition: 0.5s;
    }
    
    div.Nav div.newspaper {
      -webkit-column-count: 3;
      -moz-column-count: 3;
      column-count: 3;
      -webkit-column-rule: 2px grey solid;
      -moz-column-rule: 2px grey solid;
      column-rule: 2px grey solid;
      -webkit-column-gap: 0;
      -moz-column-gap: 0;
      column-gap: 0;
    }
    
    
    
    
      
    
    
    
      
    
    
    

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