在UL标签外输入文字,可能吗?

时间:2016-12-08 06:19:02

标签: javascript html html-framework-7

我正在学习framework7,我想知道是否可以创建一个input type="text"UL标记。在下面的代码中,css不在我的文本字段上呈现。请参阅代码注释。

这是fiddle

<!-- THIS WILL WORK -->
<div class="list-block">
  <ul>
    <li>
      <div class="item-content">
        <div class="item-inner">
          <div class="item-input">
              <input type="text" name="name">
          </div>
        </div>
      </div>
    </li>
  </ul>
</div>   

<!-- NOW, WHAT IF WE WON'T SHOW TEXTFIELD IN INSIDE UL? -->
<!-- THE CSS WON'T WORK ANYMORE, IDK WHAT IS THE CORRECT CSS CLASS EITHER TO WRAP THE ELEMENT -->
<div class="content-block">
  <input type="text" />
</div>

1 个答案:

答案 0 :(得分:1)

如果您将输入放在列表之外,您将丢失分隔线,但可以添加所需的类:

<!-- THIS WILL WORK -->
<div class="list-block">
  <ul>
    <li>
      <div class="item-content">
        <div class="item-inner">
          <div class="item-input">
              <input type="text" name="name">
          </div>
        </div>
      </div>
    </li>
  </ul>
</div>   

<!-- NOW, WHAT IF WE WON'T SHOW TEXTFIELD IN INSIDE UL? -->
<div class="content-block list-block">
  <div class="item-input">
      <input type="text" value="text here" />
  </div>
</div>

此处:https://jsfiddle.net/k5gd7Lww/10/