Как заставить CSS3 отображать колонки в IE9

Это работает в FF/Chrome/Opera и IE 10+, но не в IE9; Я ищу решение IE9

В следующем CSS-коде набор тегов div, span или p самоорганизуется в аккуратные столбцы, которые можно прокручивать по горизонтали (работает только в браузерах с поддержкой WebKit).

-webkit-column-fill: auto;
-webkit-column-width: 300px;
-webkit-column-gap: 40px;
-moz-column-fill: auto;
-moz-column-width: 300px;
-moz-column-gap: 40px;

Вот пример:

$(document).ready(function() {


  $(".RightArrow ").click(function() {
    $(".columns").animate({
      scrollLeft: '+=500'
    }, 100);
  });

  $(".LeftArrow ").click(function() {
    $(".columns").animate({
      scrollLeft: '-=500'
    }, 100);
  });



}); //end script
body {
  font-family: arial;
}
.columns {
  overflow: hidden;
  width: 500px;
  border: 1px solid #000;
  -webkit-column-fill: auto;
  -webkit-column-width: 300px;
  -webkit-column-gap: 40px;
  -moz-column-fill: auto;
  -moz-column-width: 300px;
  -moz-column-gap: 40px;
  padding: 0 20px;
  text-align: left;
  height: 500px;
  overflow: hidden;
  position: relative;
}
.notsectable {
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: -moz-none;
  -o-user-select: none;
  user-select: none;
}
.arrows {
  width: 500px;
}
.RightArrow {
  float: right;
  cursor: pointer;
}
.LeftArrow {
  float: left;
  cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="columns">



  <p>
    <a class="">

      <h2>
<span class="">1</span>
NUM 1
</h2>
      <h3>200 Broadway</h3>
      <p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
    </a>


  </p>


  <p>
    <a class="">

      <h2>
<span class="">2</span>
NUM 2
</h2>
      <h3>200 Broadway</h3>
      <p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
    </a>


  </p>

  <p>
    <a class="">

      <h2>
<span class="">3</span>
NUM 3
</h2>
      <h3>200 Broadway</h3>
      <p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
    </a>


  </p>



  <p>
    <a class="">

      <h2>
<span class="">4</span>
NUM 4
</h2>
      <h3>200 Broadway</h3>
      <p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
    </a>


  </p>


  <p>
    <a class="">

      <h2>
<span class="">5</span>
NUM 5
</h2>
      <h3>200 Broadway</h3>
      <p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
    </a>


  </p>

  <p>
    <a class="">

      <h2>
<span class="">6</span>
NUM 6
</h2>
      <h3>200 Broadway</h3>
      <p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
    </a>


  </p>

</div>
<!--columns-->


<div class="arrows">


  <span class="LeftArrow"> Previose </span>  <span class="RightArrow">  Next </span>
</div>

https://jsfiddle.net/n5qh89vw/

Причина, по которой я хочу, чтобы это работало таким образом, заключается в том, что у меня прямой вывод из БД в список <div> s, и я хотел бы избежать необходимости усложнять его и иметь выходной счетчик количества элементов данных, а затем формировать разметку в виде встроенных элементов div или таблиц (как в x числовых ячейках получится y столбцов со строками по 4) в виде Я хочу сделать это как можно проще.

Есть ли способ заставить это работать с IE?

2 ответа

Решение

Согласно " Могу ли я использовать", в IE 10+ поддерживается макет с несколькими столбцами. Если вам требуется поддержка более старых версий IE, есть многостолбцовый полифилл CSS (находится на вкладке "Ресурсы" в "Можно ли использовать").

Теперь, когда вы обновили свой вопрос, чтобы указать, что вам это нужно для IE9, вот полный пример с использованием плагина Columnizer jQuery Адама Вульфа:

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
        <script type="text/javascript" src="/path-to-local-file/jquery.columnizer.min.js"></script>
        <script>
            $(function(){
                $('.wide').columnize({width:400});
                $('.thin').columnize({width:200});
            });
        </script>

    <style>
        .column p, .column h1{ padding: 5px; }
        body { font-size: 9pt; }
        #wrapper { margin: 0px 100px; }
        .wide, .thin { clear:both; }
    </style>

</head>
<body>
    <div id="wrapper">
        <div class="wide">
            <h1>Lorem ipsum ne justo</h1>
            <p>Bonorum has. His ut cibo quas tantas, vis ut probo adhuc definiebas, has at meis debet vulputate. No sed velit essent suavitate, in pro decore ceteros temporibus, usu in odio offendit theophrastus. Mel labore indoctum cu, ad soleat admodum delicatissimi sed, mei viris tritani ullamcorper eu. Ut vim simul aperiam.</p>
            <p>Eu eleifend repudiandae has. Mea eu ridens aliquam. Nisl aeque sit ut, posse dolor utinam cum in. Ad timeam sapientem eos, et eripuit inermis nam. Eos integre voluptaria ne, iriure concludaturque ut eum.</p>
            <p>Vis erant intellegat in. Soleat legere no ius, usu ex laoreet molestie. Sit eu sint inermis. Ea zzril scribentur pro.</p>
            <h1>Tempor essent appetere</h1>
            <p>Ius mutat commune expetendis in. Nam et quas sensibus reprimique, vix no erat soluta suavitate. At mel eius dictas latine. Corrumpit inciderint reformidans sed no, no usu omnis utinam noluisse.</p>
            <p>Sit et, an ius nihil apeirian. Eu posse tempor iuvaret cum. No diam dolor sea, postea mnesarchum ne ius, vel no utinam ignota dolores. Malis suscipit accusamus his ne, utinam assentior prodesset ea eam, facer partem antiopam et cum.</p>
            <p>Probo debet quaestio an eos, no mel assum iracundia delicatissimi, rebum facete utroque sed ex. Eu melius invidunt repudiandae vix, eu paulo reformidans deterruisset duo, solum voluptaria efficiantur ea mel. Qui summo zzril alienum et. Eu est ferri iuvaret, mazim epicurei sententiae ut cum, modo reque intellegat ex vix. Vim eu tibique accusamus, quot electram at qui.</p>
            <p>Ex iisque eleifend periculis has. Sit aeterno virtute partiendo ei, eam nonumy bonorum adolescens ad. Ut nec suas vocent ornatus, cetero legendos constituam mea ea, pri cu delenit iracundia. Mundi decore nec te.</p>
            <h1>Soleat civibus in pri</h1>
            <p>In petentium erroribus percipitur per. Takimata accommodare ius ut, eam no postulant urbanitas. Qui ei tantas consectetuer, quis dictas euripidis duo ei. Quaeque democritum concludaturque has ne.</p>
            <p>Blandit insolens constituto vix an. Has diam wisi in, eum unum repudiare no. Sit at virtute rationibus, qui vitae explicari cu. Vim ne singulis voluptatum, sed puto accusata salutandi ei. Ad mel civibus adversarium.</p>
            <p>Per ne solum vivendo, fabulas dolorem vivendo in pro. Nec duis ignota cotidieque no, an per possit nostrum. Pro detraxit definitionem eu. Vivendo officiis no nam, eu has reque maiestatis percipitur, dolore reprimique accommodare cum ad. No utinam voluptua oportere pri, augue sonet dicant ei sea.</p>
            <p>Sit et, an ius nihil apeirian. Eu posse tempor iuvaret cum. No diam dolor sea, postea mnesarchum ne ius, vel no utinam ignota dolores. Malis suscipit accusamus his ne, utinam assentior prodesset ea eam, facer partem antiopam et cum.</p>
        </div>
        <div class="thin">
            <h1>Lorem ipsum ne justo</h1>
            <p>Bonorum has. His ut cibo quas tantas, vis ut probo adhuc definiebas, has at meis debet vulputate. No sed velit essent suavitate, in pro decore ceteros temporibus, usu in odio offendit theophrastus. Mel labore indoctum cu, ad soleat admodum delicatissimi sed, mei viris tritani ullamcorper eu. Ut vim simul aperiam.</p>
            <p>Blandit insolens constituto vix an. Has diam wisi in, eum unum repudiare no. Sit at virtute rationibus, qui vitae explicari cu. Vim ne singulis voluptatum, sed puto accusata salutandi ei. Ad mel civibus adversarium.</p>
            <p>Ius mutat commune expetendis in. Nam et quas sensibus reprimique, vix no erat soluta suavitate. At mel eius dictas latine. Corrumpit inciderint reformidans sed no, no usu omnis utinam noluisse.</p>
            <p>Probo debet quaestio an eos, no mel assum iracundia delicatissimi, rebum facete utroque sed ex. Eu melius invidunt repudiandae vix, eu paulo reformidans deterruisset duo, solum voluptaria efficiantur ea mel. Qui summo zzril alienum et. Eu est ferri iuvaret, mazim epicurei sententiae ut cum, modo reque intellegat ex vix. Vim eu tibique accusamus, quot electram at qui.</p>
            <p>Eu eleifend repudiandae has. Mea eu ridens aliquam. Nisl aeque sit ut, posse dolor utinam cum in. Ad timeam sapientem eos, et eripuit inermis nam. Eos integre voluptaria ne, iriure concludaturque ut eum.</p>
            <p>Sit et, an ius nihil apeirian. Eu posse tempor iuvaret cum. No diam dolor sea, postea mnesarchum ne ius, vel no utinam ignota dolores. Malis suscipit accusamus his ne, utinam assentior prodesset ea eam, facer partem antiopam et cum.</p>
            <p>Vis erant intellegat in. Soleat legere no ius, usu ex laoreet molestie. Sit eu sint inermis. Ea zzril scribentur pro.</p>
            <h1>Tempor essent appetere</h1>
            <p>Ius mutat commune expetendis in. Nam et quas sensibus reprimique, vix no erat soluta suavitate. At mel eius dictas latine. Corrumpit inciderint reformidans sed no, no usu omnis utinam noluisse.</p>
            <p>Sit et, an ius nihil apeirian. Eu posse tempor iuvaret cum. No diam dolor sea, postea mnesarchum ne ius, vel no utinam ignota dolores. Malis suscipit accusamus his ne, utinam assentior prodesset ea eam, facer partem antiopam et cum.</p>
            <p>Blandit insolens constituto vix an. Has diam wisi in, eum unum repudiare no. Sit at virtute rationibus, qui vitae explicari cu. Vim ne singulis voluptatum, sed puto accusata salutandi ei. Ad mel civibus adversarium.</p>
            <p>Per ne solum vivendo, fabulas dolorem vivendo in pro. Nec duis ignota cotidieque no, an per possit nostrum. Pro detraxit definitionem eu. Vivendo officiis no nam, eu has reque maiestatis percipitur, dolore reprimique accommodare cum ad. No utinam voluptua oportere pri, augue sonet dicant ei sea.</p>
            <p>Probo debet quaestio an eos, no mel assum iracundia delicatissimi, rebum facete utroque sed ex. Eu melius invidunt repudiandae vix, eu paulo reformidans deterruisset duo, solum voluptaria efficiantur ea mel. Qui summo zzril alienum et. Eu est ferri iuvaret, mazim epicurei sententiae ut cum, modo reque intellegat ex vix. Vim eu tibique accusamus, quot electram at qui.</p>
            <p>Ex iisque eleifend periculis has. Sit aeterno virtute partiendo ei, eam nonumy bonorum adolescens ad. Ut nec suas vocent ornatus, cetero legendos constituam mea ea, pri cu delenit iracundia. Mundi decore nec te.</p>
            <h1>Soleat civibus in pri</h1>
            <p>In petentium erroribus percipitur per. Takimata accommodare ius ut, eam no postulant urbanitas. Qui ei tantas consectetuer, quis dictas euripidis duo ei. Quaeque democritum concludaturque has ne.</p>
            <p>Blandit insolens constituto vix an. Has diam wisi in, eum unum repudiare no. Sit at virtute rationibus, qui vitae explicari cu. Vim ne singulis voluptatum, sed puto accusata salutandi ei. Ad mel civibus adversarium.</p>
            <p>Ius mutat commune expetendis in. Nam et quas sensibus reprimique, vix no erat soluta suavitate. At mel eius dictas latine. Corrumpit inciderint reformidans sed no, no usu omnis utinam noluisse.</p>
            <p>Sit et, an ius nihil apeirian. Eu posse tempor iuvaret cum. No diam dolor sea, postea mnesarchum ne ius, vel no utinam ignota dolores. Malis suscipit accusamus his ne, utinam assentior prodesset ea eam, facer partem antiopam et cum.</p>
            <p>Per ne solum vivendo, fabulas dolorem vivendo in pro. Nec duis ignota cotidieque no, an per possit nostrum. Pro detraxit definitionem eu. Vivendo officiis no nam, eu has reque maiestatis percipitur, dolore reprimique accommodare cum ad. No utinam voluptua oportere pri, augue sonet dicant ei sea.</p>
            <p>Sit et, an ius nihil apeirian. Eu posse tempor iuvaret cum. No diam dolor sea, postea mnesarchum ne ius, vel no utinam ignota dolores. Malis suscipit accusamus his ne, utinam assentior prodesset ea eam, facer partem antiopam et cum.</p>
        </div>

    </div>
</body>

Вам нужно скачать этот файл, так как для него нет CDN, поэтому не забудьте изменить path-to-local-file к фактическому местоположению файла.

Для тех, кому нужна поддержка только 10+, проблема здесь в том, что вы используете только версии CSS с префиксом поставщика. Вам также необходимо включить нормальную версию:

-webkit-column-fill: auto;
-webkit-column-width: 300px;
-webkit-column-gap: 40px;
-moz-column-fill: auto;
-moz-column-width: 300px;
-moz-column-gap: 40px;
column-fill: auto;
column-width: 300px;
column-gap: 40px;

Это сработало для меня в IE11:

$(document).ready(function() {


  $(".RightArrow ").click(function() {
    $(".columns").animate({
      scrollLeft: '+=500'
    }, 100);
  });

  $(".LeftArrow ").click(function() {
    $(".columns").animate({
      scrollLeft: '-=500'
    }, 100);
  });



}); //end script
body {
  font-family: arial;
}
.columns {
  overflow: hidden;
  width: 500px;
  border: 1px solid #000;
  -webkit-column-fill: auto;
  -webkit-column-width: 300px;
  -webkit-column-gap: 40px;
  -moz-column-fill: auto;
  -moz-column-width: 300px;
  -moz-column-gap: 40px;
  column-fill: auto;
  column-width: 300px;
  column-gap: 40px;
  padding: 0 20px;
  text-align: left;
  height: 500px;
  overflow: hidden;
  position: relative;
}
.notsectable {
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: -moz-none;
  -o-user-select: none;
  user-select: none;
}
.arrows {
  width: 500px;
}
.RightArrow {
  float: right;
  cursor: pointer;
}
.LeftArrow {
  float: left;
  cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="columns">



  <p>
    <a class="">

      <h2>
<span class="">1</span>
NUM 1
</h2>
      <h3>200 Broadway</h3>
      <p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
    </a>


  </p>


  <p>
    <a class="">

      <h2>
<span class="">2</span>
NUM 2
</h2>
      <h3>200 Broadway</h3>
      <p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
    </a>


  </p>

  <p>
    <a class="">

      <h2>
<span class="">3</span>
NUM 3
</h2>
      <h3>200 Broadway</h3>
      <p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
    </a>


  </p>



  <p>
    <a class="">

      <h2>
<span class="">4</span>
NUM 4
</h2>
      <h3>200 Broadway</h3>
      <p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
    </a>


  </p>


  <p>
    <a class="">

      <h2>
<span class="">5</span>
NUM 5
</h2>
      <h3>200 Broadway</h3>
      <p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
    </a>


  </p>

  <p>
    <a class="">

      <h2>
<span class="">6</span>
NUM 6
</h2>
      <h3>200 Broadway</h3>
      <p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
    </a>


  </p>

</div>
<!--columns-->


<div class="arrows">


  <span class="LeftArrow"> Previose </span>  <span class="RightArrow">  Next </span>
</div>

Ответ прост и НЕТ. Если вы не хотите вкладывать в это какую-то логику и делить результаты на отдельные DIV, вы не сможете получить желаемый результат. Извини:(

Другие вопросы по тегам