kattunga / IWBootstrapFramework

Intraweb Bootstrap 3 Framework for Delphi
http://kattunga.github.io/IWBootstrapFramework
MIT License
98 stars 42 forks source link

background color for label #24

Closed robertonicchi closed 8 years ago

robertonicchi commented 8 years ago

Hello,

I'm trying to change the background color for a Tiwbslabel. It doesn't works. The background color is not applied. Of course i'm using a css and it's like this:

font-family: "Oxygen"; text-shadow: 4px 4px 4px #aaa; font-size: 20px; color: black; background-color: red;

others attributes are changed, but not the background color My mistake or a bug ? Using a standard IWLabel the background is changed.

thanks

kattunga commented 8 years ago

Hello Roberto,

Please, before open an issue try to discuss it in google groups. If I correctly understand you, you have a css stylesheet for your page included in your header and you set a class to the control, isn't it? If this is the case, it has nothing to do with this framework, the problem is that bootstrap is overwriting you style. You should include your css after boostrap css, or you can use the "important!" clausule:

https://css-tricks.com/when-using-important-is-the-right-choice/

To know if this is an issue or not, you should check styles applied to the control using browser console (F12).

If you can't find the problem, please create a test case as I recommend you before so can reproduce the issue and help you.

Regards

robertonicchi commented 8 years ago

I have tried to add the IMPORTANT option but seems not to help. Now i have to take care of others thing at work. I'll be back asap with a demo app. thanks P.S. Next time i'll open a discussion post first :)

robertonicchi commented 8 years ago

Ok now i know where the problem is but don't know if it's wad.

If i set label rawtext=true and set the css property with my css class name i see that font size and font color is changed but the background color is not applied. If i set rawtext=false then all the attributes are applied.. If i want rawtext=true and want to change the background color i am forced to declare the css class into the html code:

class="myclass">some text

In other words why to set the CSS property for Tiwbslabel has a different result than settings the CSS in HTML code (when rawtext=true) ?

If necessary look at my demo app: https://www.dropbox.com/s/fl0ubxe5y19nftf/demoapp.zip?dl=0

thanks :)

kattunga commented 8 years ago

When you have problems this kind of issues always work with Developers Console (F12) open.

Go to Html tab in Console and select the label.

When rawtext := False you will see a tag:

<span class="yourclass">your content</span>

So "yourclass" style will be applied to the content.

But if you set rawtext := True and your content has other tags:

<span class="yourclass"><h4>your content</h4></span>

So "yourclass" style will be applied to the content of the "span", but not to the content of "h4", this is how css works.

robertonicchi commented 8 years ago

ok, now understand better the situation. I guess that the font color (and size) is inherited from the div to the paragraph, while the background-color is not inherited. Thanks

robertonicchi commented 8 years ago

Thinking better: shouldn't be the default background-color of the inner paragraph transparent ? This is what i have found here: http://www.w3schools.com/cssref/pr_background-color.asp I guess that transparent means that it doesn't cover the color of the parent

kattunga commented 8 years ago

May be there is some conflict with other style, or some bootstrap class. At this point you need to play with Developers Console, changing style attributes in right window. All changes that you do in Developers Console are immediately applied to the page so you can see the effects. I think that this has nothing to do with this framework.

robertonicchi commented 8 years ago

Yes seems something related to bootstrap classes. thanks