比如在最外层套一个
<div id="main"></div>
main的css代码如下:
#main{
width:1230px
height:500px
MARGIN-RIGHT: auto
MARGIN-LEFT: auto
}
放到你的#body后面、。。。
qt5.6加载html显示排版不对解决办法如下:QTextBrowser中默认的设置:
setExtensionType("html", "text/htmlcharset=iso8859-1")
setExtensionType("htm", "text/htmlcharset=iso8859-1")
setExtensionType("txt", "text/plain")
setExtensionType("xml", "text/xmlcharset=UTF-8")
如果html文件是GB2312编码的则会出现乱码,解决的方法如下:
QTextBrowser *m_phtmlBrowser
......
QMimeSourceFactory *factory=m_phtmlBrowser->mimeSourceFactory()
factory->setExtensionType("htm", "text/htmlcharset=GB2312")
factory->setExtensionType("html", "text/htmlcharset=GB2312")
factory->addFactory(factory)
......
m_phtmlBrowser->setSource(filename)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)