Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
655 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 Answer

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"> 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...