HTML/CSS not displaying correctly on a label



  • 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 :)


  • Lifetime Qt Champion

    Hi,

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.