2012-02-07 17 views
7

enter image description here我們使用的代碼來自與定位相關的較少文件。該網站在safari,firefox和chrome中看起來很棒,並且在IE 7,8和9版本中看起來很不錯。引導程序是否有IE的一個已知問題?可能沒有,因爲它被廣泛使用。但我無法真正識別出什麼問題。順便說一句,這裏有兩個示例頁面,其中包含Internet Explorer中的視覺錯誤:http://www.presspass.me和更簡單的頁面:http://www.presspass.me/about或者您可以查看屏幕截圖。我們使用twitter bootstrap中的一些代碼,我們的div在Internet Explorer中關閉(7-9)

我的猜測是它很小,任何幫助將不勝感激!

/* 
* Scaffolding 
* Basic and global styles for generating a grid system, structural layout, and page templates 
* ------------------------------------------------------------------------------------------- */ 

// Variables 
// Can also be 24/20/20 
// Or 16/40 /20 
@gridColumns:  24; 
@gridColumnWidth: 20px; 
@gridGutterWidth: 20px; 
@extraSpace:  (@gridGutterWidth * 2); // For our grid calculations 
@siteWidth:   (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1)); 


// Mixins 
// Clearfix for clearing floats like a boss h5bp.com/q 

.clearfix() { 
    zoom: 1; 
    &:before, 
    &:after { 
    display: table; 
    content: ""; 
    zoom: 1; 
    } 
    &:after { 
    clear: both; 
    } 
} 

// Center-align a block level element 
.center-block() { 
    display: block; 
    margin-left: auto; 
    margin-right: auto; 
} 

.fixed-container() { 
    width: @siteWidth; 
    margin-left: auto; 
    margin-right: auto; 
    .clearfix(); 
} 

.columns(@columnSpan: 1) { 
    width: (@gridColumnWidth * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1)); 
} 

.offset(@columnOffset: 1) { 
    margin-left: (@gridColumnWidth * @columnOffset) + (@gridGutterWidth * (@columnOffset - 1)) + @extraSpace; 
} 

// Necessary grid styles for every column to make them appear next to each other horizontally 
.gridColumn() { 
    display: inline; 
    float: left; 
    margin-left: @gridGutterWidth; 
} 

// makeColumn can be used to mark any element (e.g., .content-primary) as a column without changing markup to .span something 
.makeColumn(@columnSpan: 1) { 
    .gridColumn(); 
    .columns(@columnSpan); 
} 


// STRUCTURAL LAYOUT 
// ----------------- 
/* 
body { 
    margin: 0; 
} 
*/ 
// Container (centered, fixed-width layouts) 
.container { 
    .fixed-container(); 
} 

// Fluid layouts (left aligned, with sidebar, min- & max-width content) 
.container-fluid { 
    position: relative; 
    min-width: 940px; 
    padding-left: 20px; 
    padding-right: 20px; 
    .clearfix(); 
    > .sidebar { 
    position: absolute; 
    top: 0; 
    left: 20px; 
    width: 220px; 
    } 
    // TODO in v2: rename this and .popover .content to be more specific 
    > .content { 
    margin-left: 240px; 
    } 
} 


// BASE STYLES 
// ----------- 

// Quick floats 
.pull-right { 
    float: right; 
} 
.pull-left { 
    float: left; 
} 

// Toggling content 
.hide { 
    display: none; 
} 
.show { 
    display: block; 
} 


// GRID SYSTEM 
// ----------- 
// To customize the grid system, bring up the variables.less file and change the column count, size, and gutter there 

.row { 
    .clearfix(); 
    margin-left: [email protected]; 
} 

// Find all .span# classes within .row and give them the necessary properties for grid columns (supported by all browsers back to IE7) 
// Credit to @dhg for the idea 
.row > [class*="span"] { 
    .gridColumn(); 
} 

// Default columns 
.span1  { .columns(1); } 
.span2  { .columns(2); } 
.span3  { .columns(3); } 
.span4  { .columns(4); } 
.span5  { .columns(5); } 
.span6  { .columns(6); } 
.span7  { .columns(7); } 
.span8  { .columns(8); } 
.span9  { .columns(9); } 
.span10 { .columns(10); } 
.span11 { .columns(11); } 
.span12 { .columns(12); } 
.span13 { .columns(13); } 
.span14 { .columns(14); } 
.span15 { .columns(15); } 
.span16 { .columns(16); } 

// For optional 24-column grid 
.span17 { .columns(17); } 
.span18 { .columns(18); } 
.span19 { .columns(19); } 
.span20 { .columns(20); } 
.span21 { .columns(21); } 
.span22 { .columns(22); } 
.span23 { .columns(23); } 
.span24 { .columns(24); } 

// Offset column options 
.row { 
    > .offset1 { .offset(1); } 
    > .offset2 { .offset(2); } 
    > .offset3 { .offset(3); } 
    > .offset4 { .offset(4); } 
    > .offset5 { .offset(5); } 
    > .offset6 { .offset(6); } 
    > .offset7 { .offset(7); } 
    > .offset8 { .offset(8); } 
    > .offset9 { .offset(9); } 
    > .offset10 { .offset(10); } 
    > .offset11 { .offset(11); } 
    > .offset12 { .offset(12); } 
} 

// Unique column sizes for 16-column grid 
.span-one-third  { width: 300px; } 
.span-two-thirds { width: 620px; } 
.row { 
    > .offset-one-third { margin-left: 340px; } 
    > .offset-two-thirds { margin-left: 660px; } 
+1

指定什麼是「關」,不是每個人都有IE,但如果我們看看IE屏幕截圖,也許很簡單:) – bzx 2012-02-07 11:51:46

+0

是的,好主意bzx,特別是在SO上,大多數人都沒有IE。讓我截圖並附上它們。 – 2012-02-07 12:00:37

+1

@DavidHaddad:創建一個最小的測試用例。也就是說,繼續從中取出東西(HTML和CSS),直到您儘可能小,但仍然顯示問題。在你這樣做之前,你可能得不到幫助。一旦你確定了問題的位置,你甚至可以自己解決問題。 – 2012-02-07 12:12:29

回答

15

我的猜測是,它的小東西,任何幫助,將不勝感激!

這是小事。

您錯過了一個文檔類型。添加爲第一行:

<!DOCTYPE html> 

沒有有效的doctype,頁面將顯示在quirks mode

打開開發工具(按F12)查看實際使用哪種模式。

+0

天才!那麼,IE只是假設頁面是舊式html? – 2012-02-07 12:33:36

+2

IE的怪癖模式[模擬* IE5.5 *](http://hsivonen.iki.fi/doctype/#quirksmode),這不是很擅長CSS。 – thirtydot 2012-02-07 12:35:11

+0

順便說一句,我添加了這個特殊的一個:<!DOCTYPE HTML PUBLIC「 - // W3C // DTD HTML 4.01 // EN」「http://www.w3.org/TR/html4/strict.dtd」>謝謝,不會猜測它在一個長鏡頭。 – 2012-02-07 12:54:14

2

有時您也必須重寫可能會強制IE進入非兼容模式的組策略。我們必須在我的組織中執行此操作,因爲組策略在Intranet上強制使用此模式。

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
+0

OMFG我已經有這個問題很長時間了,不知道!告別我的所有ifIE代碼和備用頁面...你是我的英雄! – 2014-07-04 18:10:15

+0

是。這是真的。傳統應用程序吸引。 :) – engineerDave 2014-07-04 18:11:50

1

我和Bootstrap 2.2.1有類似的問題。 IE 9在開發它的時候看起來很棒。然而,其中一個用戶在IE 7上(不要問,唉),並且大部分頭文件沒有正確顯示。解決方案是將所有HTML 5標籤(標題,頁腳,文章和部分)更改爲div。這對我來說是訣竅。

我曾試着用DOCTYPE等方法來完成上面的建議,但在此之前我沒有完全爲之工作。

相關問題