Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
656 views
in Technique[技术] by (71.8m points)

html - Issues with IE8 when applying Position: fixed

Here's my css code:

background-color: White;
border: 2px solid black;
padding: 10px;
position: fixed;
right: 5px;
top: 0;
width: 250px;

It works great in Chrome/Firefox/Safari, but I can't get it working in IE8. The position of div box isn't not in the top right corner. Any ideas on how I can solve this problem?

Along with the HTML

<div style="position:fixed;top:0;right:5px;background-color:White;padding:10px;border:2px black solid;width:250px;">
  <div>content here</div>
</div>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try adding this in the very top of the document above the header.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd"> 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...