Hello,

I have followed the document from http://doc.qtsoftware.com/4.5/richtext-html-subset.html to set some css style when declaring an html string that will later on be used in a QTextEdit widget.

Some of the css style are working, while others have not effect.
In my example:
background is working
color is working
align is NOT working
font-size is NOT working

Did I miss something?

Qt Code:
  1. #include <QtGui>
  2.  
  3. int main(int argc, char *argv[])
  4. {
  5. QApplication app(argc, argv);
  6. QString html_sequence = QString(" \
  7. <html> \
  8. <head> \
  9. <style type=text/css> \
  10. body { background: #ffffff; color: black; } \
  11. .title { background: #f0f0f0; align: center; } \
  12. .subtitle { font-size: 8px; color: red;} \
  13. .small-subtitle { font-size: 6px; color: blue; } \
  14. </style> \
  15. </head> \
  16. \
  17. <body> \
  18. <h1 class=title>Title without subtitle<br /></h1> \
  19. <h1 class=title>Title with subtitle<br /><span class=subtitle>This is the subtitle</span></h1> \
  20. <h1 class=title>Title with small subtitle<br /><span class=small-subtitle>This is the small subtitle</span></h1> \
  21. </body> \
  22. </html> \
  23. ");
  24.  
  25. QTextEdit test(html_sequence);
  26. test.show();
  27. return app.exec();
  28. }
To copy to clipboard, switch view to plain text mode