【问题标题】:A HTML page doesn't display right in a QWebviewHTML 页面无法在 QWebview 中正确显示
【发布时间】:2012-07-19 18:17:24
【问题描述】:

我正在做一个小软件,它有一个QWebView来显示HTMLfiles。我的问题是我的欢迎页面显示不好。它看起来像,它应该在中间的那些红线之间有一个图像。问题肯定是我的HTML和/或CSS. So here is myHTML`:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="styles/accueil.css" rel="stylesheet" type="text/css" media="screen" />
</head>

<body>

    <div class="container">

        <div class="ligne">&nbsp;</div>

    </div>

    <div class="ligne">&nbsp;</div>    
</body>
</html>

还有我的CSS

@charset "UTF-8";
/* CSS Document */

body{
    background-color:white;
    margin:0 auto;
    height:100%;
}

html {
    overflow-y: scroll;
    height:100%;
}

img{
    border:none;
}

.container {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -20px;
    background-image: url(../icones/accueil.jpg);
    background-repeat:no-repeat;
    background-position:center center;
}

.ligne{
    width:100%;
    height: 20px;
    background-color:#ee1b2e;
}

知道我写错了什么吗?

谢谢!

--------编辑-----

只有在 XP 上才会发生这种情况......在 MAC、7 和 Vista 上它可以找到。它应该看起来像 this

【问题讨论】:

  • 否则,如果有人有其他方法来制作这样的页面,我会尝试的!我的 HTML CSS 不太好,所以我很开放

标签: html css qt qwebview


【解决方案1】:

我不确定具体原因,但问题是我的图像...我需要一个 .png 图像而不是 .jpg

【讨论】:

    【解决方案2】:

    我猜这是当您在未安装 Qt 的计算机上使用带有 qwebview 的程序时。如果是这样,添加到程序目录文件夹 [imageformats]。只需从 Qtdir 复制它。 Qt默认支持*.png和*.svg格式,对于*.jpg等格式,windows需要设置dll。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-30
      • 2014-11-19
      • 2011-03-31
      • 2018-03-19
      • 2020-07-12
      • 1970-01-01
      相关资源
      最近更新 更多