我有一个 HTML 文件,我正在加载到一个 JTextPane 中,其中包含我试图并排显示的两个 DIV(使用 CSS float
)。但是,无论我尝试什么,都行不通。instructions
元素始终显示在元素下方title
。我也尝试过调整宽度。JTextPane 是否不支持此 CSS 属性 - 我必须使用表格吗?该文件在 Safari 中正确显示。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
@font-face {
font-family: Mentone;
src: local(Mentone),
url(Mentone.otf) format("opentype"),
}
div#container { width: 95%; margin: 0px auto; }
div#title { font-family: Mentone; font-size: 108px; width: 200px; margin: 100px 15px 0 15px; float: left; }
div#instructions { font-family: Mentone; font-size: 130%; width: 300px; margin: 100px 15px 0 15px; color: #dddddd; }
</style>
<title>Welcome</title>
</head>
<body>
<div id="container">
<div id="title">my app</div>
<div id="instructions">Instructions go here.</div>
</div>
</body>
</html>