Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. HTML/CSS not displaying correctly on a label
Forum Updated to NodeBB v4.3 + New Features

HTML/CSS not displaying correctly on a label

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 782 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    WhatIf
    wrote on 18 Dec 2015, 18:08 last edited by
    #1

    Hi,

    I have a label which has html and simple css to display an image and a list below it. The image and list show up but the problem I have is I want the bullet list to be in red and the text to be in blue. The text show in blue but the bullet display in black.

    I ran the html code in my browser and it displayed correctly, red bullets and blue text.

    <!DOCTYPE html>
    <html>
    
    <head>
    <style type="text/css">
    	
            ul {
               list-style: disc;
               color: red;
            }
            
            ul li span {
               color: blue;
            }
    	
    	</style>
    </head>
    
    <body>
    
    <img src="test image.jpg" alt="Image could not be displayed" style="width:284px;height:67px;">
    
    <h1 style="font-family: Segoe print; ">
     <ul>
      <li><span>Item 1</span></li>
      <li><span>Item 2</span></li>
      <li><span>Item 3</span></li>
    </ul> 
    </h1>
    
    </body>
    </html> 
    

    Would greatly appreciate your assistance :)

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 18 Dec 2015, 22:11 last edited by SGaist
      #2

      Hi,

      QLabel supports only a subset of HTML and style. If you want something more complete QTextBrowser might be a better fit.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      1/2

      18 Dec 2015, 18:08

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved