【问题标题】:Twitter bootstrap 3 form-horizontal not working in ASP.NET w/IE8Twitter bootstrap 3 form-horizo​​ntal 在 ASP.NET w/IE8 中不起作用
【发布时间】:2014-10-23 05:57:37
【问题描述】:

我正在尝试在 ASP.NET 中创建一个 Web 表单,其控件标签位于输入控件的左侧,但在 IE8 中它们是一个在另一个之上。我按照推荐使用 html5shiv 和 respond.js。这是我最近的尝试。我们的企业标准是 IE8(我知道,我知道,不要让我开始)。任何想法如何使这项工作?谢谢。

<div class="container"> <!-- for bootstrap  -->
<div class="row">       <!-- for bootstrap  -->
    <div class="form-horizontal" role="form">
        <div class="form-group">
            <label for="txtProfitShareYear" class="col-md-2 control-label">Profit Share Year</label>
            <div class="col-md-10">
                <input type="text" class="form-control" id="txtProfitShareYear" placeholder="rule year">
            </div>
        </div>
        <div class="form-group">
            <label for="txtCompanyID" class="col-md-2 control-label">Company ID</label>
            <div class="col-md-10">
                <input type="text" class="form-control" id="txtCompanyID" placeholder="rule year">
            </div>
        </div>
        <div class="form-group">
            <label for="txtMaxPayAmount" class="col-md-2 control-label">Max Pay Amount</label>
            <div class="col-md-10">
                <input type="text" class="form-control" id="txtMaxPayAmount" placeholder="deferral amount ratio">
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-10">
                <button type="button" class="btn btn-default" id="btnModalSave">Save</button>
            </div>
        </div>
    </div>
</div>  <!-- /.row -->
</div>  <!-- /.container -->

这是我的整个头部。如果我删除条件 CSS,它会起作用。

<title>Medical Group 401k</title>

<link rel="stylesheet" type="text/css" href="Styles/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" media="screen" href="Styles/Site.css" />
<link href="Styles/jquery.dataTables.min.css" rel="stylesheet" />

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- [if lt IE 9]>
  <script src="Scripts/html5shiv.min.js"></script>
  <script src="Scripts/Respond.min.js"></script>      
<![endif]-->

<script type="text/javascript" src="http://decisionsupport/WebLibrary/jquery/jquery-1.9.1.js"></script>
<script type="text/javascript" src="Scripts/bootstrap.min.js"></script>
<script type="text/javascript" src="Scripts/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="Scripts/Site.js"></script>

<style type="text/css">

</style>

@cvrebert:是的,一个空格导致 IE8 忽略了条件 CSS。 而不是这个:

<!-- [if lt IE 9]>

需要这样: &lt;!--[if lt IE 9]&gt;

【问题讨论】:

标签: asp.net webforms twitter-bootstrap-3


【解决方案1】:

您好,您是否确定了对 respond.js 的脚本调用位于您的 CSS 之下(但仍然在 HTML 的头部,这让我一开始就发现了这一点)。

【讨论】:

    【解决方案2】:

    找到了我的答案here,CSS 条件中的一个额外的@%^&* 空格把它搞砸了。你在开玩笑吗?

    引用一位伟大的美国人的话,“DOH!”

    感谢所有回复的人。

    【讨论】:

    • 啊,所以&lt;!--[if lt IE 9]&gt; 而不是&lt;!-- [if lt IE 9]&gt;
    猜你喜欢
    • 1970-01-01
    • 2014-06-28
    • 2012-11-10
    • 1970-01-01
    • 2016-01-22
    • 2012-11-15
    • 2013-08-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多