【问题标题】:Div element not showing up on page, even after inspect elementdiv 元素没有显示在页面上,即使在检查元素之后
【发布时间】:2017-03-16 17:08:46
【问题描述】:

我有一个网站,应该适合手机和电脑,但我还没有添加后者。问题是,我有两个带有 class="row" 的标签,但只显示第一个(在页面足够小之后)。代码:

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="api/reponse-api-2.css">
    <link rel="stylesheet" href="css/index.css">
</head>
<body class="nomargin">
    <!--MOBILE VERSION-->
    <div class="size-small">
        <div class="row"><iframe frameBorder="0" src="html/header-small.html" class="col-12" height="100px"/></div>
        <div class="row">
            <div class="col-12 checkbox-mobile">
                <form>
                <input type="checkbox">Embed site in browser</input>
                </form>
            </div>
        </div>
    </div>

    <!--TABLET VERSION-->
    <div class="size-medium">
        tablet
    </div>

    <!--PC VERSION-->
    <div class="size-large">
        pc
    </div>
</body>

【问题讨论】:

  • 请分享您的 CSS 文件
  • 问题不在于显示,因为如果我单击“检查元素”,它也不会显示。 (见标题)
  • PieterMantel 您的问题与 html 语法有关,请参阅@Roy 的以下回答

标签: html invisible


【解决方案1】:

错误语法是 HTML:

<div class="size-small">
       <!-- The iframe must be closed </iframe> -->
       <!-- (if bootstrap) The class col-12 is col-sm-12 or col-md-12 or col-xs-12 (NOT col-12)  -->
        <div class="row"><iframe frameBorder="0" src="html/header-small.html" class="col-12" height="100px"></iframe></div>
        <div class="row">
            <div class="col-12 checkbox-mobile">
                <form>
                <!-- The input close is wrong. -->
                <!-- <input type="checkbox">BAD</input> -->
                     <input type="checkbox">GOOD
                </form>
            </div>
        </div>
    </div>

【讨论】:

  • 只需添加评论以使答案更容易理解。 iframe 不会自动关闭,因此您实际上需要包含 ,其次复选框类型的输入不会关闭。两者都是这里的问题,但是 iframe 导致未显示的
    的结束标记出现问题。
  • 哦,好的,谢谢!我不使用引导程序,而是使用我自己的响应式 API,因为我认为引导程序添加了很多废话。
猜你喜欢
相关资源
最近更新 更多
热门标签