2013-09-26 57 views
5

Tôi đang cố gắng tạo lưới bốn cột bằng cách sử dụng mã sau. Mã này hoạt động hoàn hảo trong Chrome nhưng không tạo các cột trong firefox.moz-cột không hoạt động trong firefox

Bạn có thể kiểm tra mã sau đây sống ở đây: http://jsfiddle.net/rfTXX/1/

Tôi đã kiểm tra hướng dẫn này http://css-tricks.com/almanac/properties/c/columns/ và tôi nghĩ rằng mã của tôi là được rồi, nhưng nó vẫn không làm việc trong firefox.

Bạn có thể cho tôi biết cách sửa css để nó hoạt động trong hầu hết mọi trình duyệt không?

CSS

#wrapper { 
width: 90%; 
max-width: 1100px; 
min-width: 800px; 
margin: 50px auto; 
} 

#columns { 
-webkit-column-count: 4; 
-webkit-column-gap: 10px; 
-webkit-column-fill: auto; 
-moz-column-count: 4; 
-moz-column-gap: 10px; 
-moz-column-fill: auto; 
column-count: 4; 
column-gap: 15px; 
column-fill: auto; 
} 
</style> 

HTML

<div id="wrapper"> 
<div id="columns"> 

    <div class="pin"> 
     <img src="http://cssdeck.com/uploads/media/items/2/2v3VhAp.png" /> 
     <p> 
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
      Sed feugiat consectetur pellentesque. Nam ac elit risus, 
      ac blandit dui. Duis rutrum porta tortor ut convallis. 
      Duis rutrum porta tortor ut convallis. 
     </p> 
    </div> 

    <div class="pin"> 
     <img src="http://cssdeck.com/uploads/media/items/2/2v3VhAp.png" /> 
     <p> 
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
      Sed feugiat consectetur pellentesque. Nam ac elit risus, 
      ac blandit dui. Duis rutrum porta tortor ut convallis. 
      Duis rutrum porta tortor ut convallis. 
     </p> 
    </div> 


    <div class="pin"> 
     <img src="http://cssdeck.com/uploads/media/items/2/2v3VhAp.png" /> 
     <p> 
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
      Sed feugiat consectetur pellentesque. Nam ac elit risus, 
      ac blandit dui. Duis rutrum porta tortor ut convallis. 
      Duis rutrum porta tortor ut convallis. 
     </p> 
    </div> 

     <div class="pin"> 
     <img src="http://cssdeck.com/uploads/media/items/2/2v3VhAp.png" /> 
     <p> 
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
      Sed feugiat consectetur pellentesque. Nam ac elit risus, 
      ac blandit dui. Duis rutrum porta tortor ut convallis. 
      Duis rutrum porta tortor ut convallis. 
     </p> 
    </div> 

</div> 
</div> 

Trả lời

15

Cố gắng mà không có sự column-fill bất động sản, cần làm việc.

Hoặc sử dụng -moz-column-fill: balance; để thay thế.

+0

Nhờ làm việc của nó. Tôi đã phải loại bỏ '-moz-cột-điền: tự động;' để làm cho nó hoạt động. Nhưng không có '-moz-column-fill: auto;' nó không tạo ra khoảng trống giữa mỗi lưới. –

+2

Sử dụng '-moz-column-fill: balance;' thay vì '-moz-column-fill: auto;' để làm cho nó hoạt động trên Firefox. Nó làm việc cho tôi! – SauriolJf

0

Thuộc tính quy tắc -moz-cột được hỗ trợ trong Firefox từ phiên bản 3.5. http://help.dottoro.com/lcqjxgjq.php

+0

Tôi đang sử dụng phiên bản Firefox mới nhất nhưng vẫn không hoạt động :( –

-1

Sử dụng -moz-column-fill:balance thay vì -moz-column-fill:auto

Đừng hỏi tôi tại sao nhưng nó làm việc cho tôi!

1

Chỉ cần được ở bên an toàn bao gồm -moz-column-count:"your value" trong css và bao gồm một kịch bản java document.getElementById("lstAccessList").style.MozColumnCount = "your value"; ủy thác cho tôi này làm việc cho tôi sau khi một tìm kiếm đầy đủ.

0

remove cột điền và thêm -moz-columns:4; nó làm việc cho tôi