background qlineargradient in stylesheet does not work



  • Hi,
    I have a .html page which contains a section where I want to have a gradient effect.
    Here is the css for that:
    #testStuff {
    font-family:Arial, Tahoma, Geneva, sans-serif;
    font-size:13px;
    font-weight:normal;
    color:black;
    background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 cyan, stop:1 blue);
    }
    Later on I have the following:
    <div id="testStuff">Hello</div>

    In the resulting HTML, I do not see any background color for this - I see "Hello", with no background.
    So qlineargradient is not working as far as I can see.

    I am using qt 4.8.6.

    Is there something wrong in my syntax. How should I fix it ?

    Thanks for any help.


  • Moderators

    qlineargradient is part of qss, a css based language used for styling widgets. It's not meant to be used in HTML.
    Where do you display that HTML? In a QTextEdit? In a QWebView? If it's a QWebView then you need to use the standard css3: linear-gradient.



  • Thanks for your reply Chris.
    I display the HTML using QtAssistant. However, linear-gradient does not work when viewed that way unfortunately.


  • Moderators

    @didje
    beside what Chris Kawa said, you are using an ID selector, but defined a CLASS in your HTML element.
    This rule wouldn't be applied anyway.



  • Yes, I know, sorry my mistake in posting, but even when the rule is applied I have the same problem.


  • Moderators

    @didje said:

    Yes, I know, sorry my mistake in posting, but even when the rule is applied I have the same problem.

    Thats why i said "beside what Chris Kawa said"


Log in to reply
 

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