回答
爲什麼你不能直接輸入?
在HTML:
— or —
而且在CSS:
content:"\2014"
我必須通過css導入才能使其工作。 div#algemene_informatie h2:在{ \t內容:' - '; – user2175191 2013-03-15 19:06:43
我剛剛編輯了我的答案,它回答了你的問題:) – doitlikejustin 2013-03-15 19:09:50
IE7不支持生成的內容。 – 2013-03-15 19:13:31
在CSS:
// Support IE7, which doesn't support :before pseudo selectors
*zoom: expression(
function(t) {
t.runtimeStyle['zoom'] = '1';
t.innerHTML = "— " + t.innerHTML;
}(this)
);
考慮到IE表達式功能非標準/無效,這是有意義的。 – 2013-03-15 19:28:26
我不能只使用Modernizr和generatedcontent的自定義構建嗎?如果是的話,我將如何調整我的CSS選擇器? – user2175191 2013-03-15 19:31:14
Modernizr不會自動爲生成的內容填充支持......它只會告訴您支持存在或不支持。 IE9.js填充了這個能力,但是如果你想避免添加IE9.js,這個CSS將會起作用。 @MaratTanalin,是的,它是非標準/無效的,只在IE7中評估(在屬性名稱之前的'*'使得該屬性不被其他瀏覽器評估)。是的,這是一個黑客攻擊,但它是一種黑客行爲,只需要在你的CSS中添加6行,而將整個庫添加爲polyfill。 – thirdender 2013-03-15 21:58:50
對於超過8舊版本的IE瀏覽器,產生通過JavaScript真正的元素,使它們包含的實際內容相當於生成的:before
/:after
的內容oelement:
var example = document.getElementById('example'),
span = document.createElement('span');
span.innerHTML = '—'
example.appendChild(span);
,然後裝用相同的樣式span
元素作爲:before
/:after
產生pseudoelement。
順便說一下,考慮放棄支持IE7這種古老的IE版本。其實,現在是時候考慮放棄對IE8的支持了。 ;-)
+1對於IE7的支持,儘管我爲大公司工作的大多數項目仍然支持「IE7支持」規定。令人討厭的是,但我認爲這是因爲很多軍團仍然運行XP,而一些IT部門卻懶惰:-p雖然這不是世界上最糟糕的要求......至少它不是IE6:-p – thirdender 2013-03-15 22:14:23
- 1. Internet Explorer 7 CSS
- 2. Internet Explorer 7 float
- 3. Internet Explorer的6/7
- 4. Windows 7中的Internet Explorer 8
- 5. Internet Explorer 7中的Fancybox/JQuery
- 6. Internet Explorer 7中的jQuery .is()
- 7. jQuery的AJAX在Internet Explorer 7
- 8. Internet Explorer 7 - Javascript'undefined'not testing
- 9. Internet Explorer 7 CSS bug
- 10. 在Internet Explorer中打破SVG標記?
- 11. Internet Explorer中的連字號
- 12. jQuery的.find()在Internet Explorer 7和Internet Explorer 8
- 13. 背景上的Internet Explorer 7
- 14. Internet Explorer 7的CSS問題
- 15. Internet Explorer 7的錯誤
- 16. Internet Explorer破碎圖片
- 17. Internet Explorer 10'破損圖像'
- 18. 讓網頁在Internet Explorer 7中呈現
- 19. 如何在Internet Explorer 7中禁用Cookie?
- 20. 在Internet Explorer 7中更改div高
- 21. 在Internet Explorer 7中垂直對齊
- 22. 用破折號
- 23. 破折號
- 24. 破折號
- 25. java2d破折號
- 26. .htaccess中的破折號(' - ')
- 27. htaccess的破折號
- 28. 華廷和Internet Explorer 7
- 29. Internet Explorer 7和表子彈
- 30. Internet Explorer 7 Ajax未加載
在目前的形式下,這個問題沒有意義。在IE 7中,em dash沒有特別的問題。從評論中看來,你真正的問題可能在於生成的內容或其他東西。請編輯問題以反映真實問題。 – 2013-03-15 20:05:02