I need a widget that can output text with colored background. I want to be able to set the text and backround color of certain position of the text, for example 'abc' (a-red bg, b-green bg etc.).
Something like this:
span {
font-size: 16px;
color: white;
}
<span style="background-color:red;">a</span>
<span style="background-color:green;">b</span>
<span style="background-color:blue;">c</span>
Can i achieve this with standart widgets like TextEdit or i need to write my own?
Related
I want to change the appearance (color) of the text inside the div inside the button when the accordion is open but not being hovered on. I have been able to alter the color of the text on hover when the accordion is open, but once I am no longer hovering on the text and the accordion is open, the text color goes grey again rather than staying red. I am asking for help to maintain the color of the text within the button when the accordion panel is open, but not being hovered on. I.E. When hovered on and accordion is open, color is a dark red, when accordion is open, but not hovered on, I want it to remain dark red. When the accordion is collapsed, I want the text to be grey. the hover title (div.btn_inner-silver)text color when the accordion panel is open the color of the text as it appears when hovered on.
How it appears when closed
How text appears when on hover
How it appears when uncollapsed/open
How I want it to appear when open/uncollapsed
HTML MARK UP
<div class="accordion" id="acrd_sidebar1-14">
<!-- DATE/TIME -->
<div class="accordion-item">
<h2 class="accordion-header" id="hdr_timestamp1-14">
<button type="button" aria-expanded="true" data-mdb-toggle="collapse" data-mdb-target="#collapsetimestamp1-14" aria-controls="collapsetimestamp1-14" class="accordion-button pd_all8 btn_sidebar-brand">
<div class="btn_inner-silver" >
Date + Time
</div>
</button>
</h2>
CSS
.btn_inner-silver {
width: 100%;
margin: 0;
padding: 8px;
border: 1px solid silver!important;
background: white;
text-align: center!important;
font-weight: 400;
color: silver;
}
.btn_inner-silver:hover {
color: #981e21;
}
.btn_inner-silver collapsed {
color: #981e21;
}
h2.accordion-header button.accordion-button.btn_sidebar-brand div.btn_inner-silver collapsed:focus {
color: pink!important;
}
SUMMARY of QUESTION
How do I keep the color of the text red when the selected accordion panel is open/uncollapsed?
I have tried a number of things, but am unable to target the open state. I've googled galore, sifted through the stack, experimented and failed repeatedly. Hoping for help. I am a newb.
First, it looks like your missing the . in front of collapsed in the rule below.
.btn_inner-silver collapsed {
color: #981e21;
}
Secondly, in the Accordion example here, they are using the CSS pseudo-class :not() to target the element that does not have the .collapsed class.
So it would look something like this I think for you:
.accordion-button:not(.collapsed) .btn_inner-silver{
color: #981e21;
}
this is my first time using glyphs, but i know this much they are text, and can be styled just like any other text.
This is the reason I'm confused to why my glyphs icon is not changing colour.
I want it to change the colour from black(default) to white. This is my code:
HTML
<li><span class="glyphicon glyphicon-cog"></span><a class="lolo" href="Franchise-Details.php"><b>Admin Panel</b></a></li>
CSS
.glyphicon glyphicon-cog{
color: #fff;
margin-right: 2px;
}
where have a gone wrong? any help would be appreciated
It should be
.glyphicon.glyphicon-cog{
color: #fff;
margin-right: 2px;
}
You have missed a . before the glyphicon-cog and also the space between the two classes is not required.
As the space indicates that glyphicon class named element is parent and glyphicon-cog named element is under this parent, which is not the case in your scenario.
Since you are targeting the same element with two classes the syntax should be
.classOne.classTwo
Try not to override the colors of of your glyphs. You may need to use a different color for the same glyph elsewhere. Instead make a CSS class like:
.white
{ color: #fff; }
-and keep the margins to your "glyphicon" class, then reserve the "glyphicon-cog" class only for the data (before content *unicode) as this saves file-size because you do not need to define margins for every single glyph, only in the font-class: "glyphicon" -if required.
Then simply use in HTML as:
<span class="glyphicon glyphicon-cog white"></span>
Is there a way to make css icons like Font Awesome (or any other CSS icons) have 2 colors?
I know they are fonts so the color can be changed by something like style='color: red;', but is there a way to use 2 colors for the icons like an accent color and a main color?
The only options you have are,
You can use text-shadow to give it a different colored shadow or stroke.
You would need to use svg icons to control the path colors.
You can utilize color & background-color to control 2 color on the same icon, as long as you only need 2 colors (no other background).
<i class="fa fa-motorcycle blue onred"></i>
.blue {
color: blue;
}
.onred {
background-color: red;
}
fiddle
I have a webpage here: http://www.indiespil.dk/aitasi-under-construction-page/Aitasi/image/
I downloaded a HTML template, and I think it is using Bootstrap. I am no programmer, so this is the first time I am using HTML, CSS, Bootstrap and all that kind of stuff.
Everything is perfectly okay on my webpage as for now, except 1 thing: the text color in the second section, where it says "Competition", "Game wallet", "Indie Coins" and "Community"
These words are black, and I need them to be white instead.
The text is called as for now, which has the color code #000000 and a size of 18px.
I need the h3 to be used lower on the website, but I would like to make a custom header (h7 for instance) that has the same size as h3, but is white instead.
I tried making a h7 and it actually came out white and the same size, but when I entered h7 in my index file it didn't align, as the rest.
How can I make it align properly?
Thanks.
You dont need to create an H7 header element simply add the !important rule to a separate class in your css when changing the colour like this.
HTML
<h3 class="whiteTextOverride"> example with white text override </h3>
<h3> example with default colour </h3>
CSS
.whiteTextOverride
{
color: white !important;
}
This will override the colour set by bootstrap and allow you to choose a specific colour for the text in that header only.
P.S. its worth mentioning that you shouldnt go crazy with the !important feature in css as it can affect other classes if you are not careful with it so use it minimally and have a look at this article on when you should use it. Good luck!
Example
h3
{
color: red;
}
.whiteTextOverride
{
color: white !important;
}
.darkBackground
{
background: #000000;
}
<div class="darkBackground">
<h3 class="whiteTextOverride"> example with white text override </h3>
<h3> example with default colour </h3>
</div>
From what it looks like, I'm guessing the h7 tag was not aligned because the h3 element is preceded by the .service class. If you want to make a h7 you have to make sure it has a class of .service before the h7 tag in the css. The h3 tag is setup like so:
.service h3{
color: #000000;
font-size: 18px;
text-transform: uppercase;
}
You'd want to do something like this:
.service h7{
color: #FFFFFF;
font-size: 18px;
text-transform: uppercase;
}
Hope that helps.
I am working on a GUI and I've run into a problem. If I set a button, label, or other widget to have a background color, the tooltip for that widget also takes the same background color. I tried editing the style sheet for the tooltip specifically and setting a different background color but it doesn't work. I also tried editing the palette for the widget but changing the color scheme for the tooltip background or text doesn't work either. Is there another way I can do this? I'd like to have consistency between all my tooltips.
Thanks!
You can do something like this to style a QToolTip in general.
QToolTip { color: #fff; background-color: #000; border: none; }
When you need to style QToolTips specifically, based on their parent widget you can use following syntax:
ParentWidgetName QToolTip { color: #333; background-color: #1c1c1c; border: none; }
Reading this will help you further.