Why is my red background not displaying in my table? - html

I have a mockup here
http://jsfiddle.net/Q77RZ/
Without bootstrap everything is OK. How can I override the bootstrap settings?

You just need to make it a little more specific:
table.table tbody td.red-background {
color: black;
background-color: red;
font-size: 30px;
}​
Demo here.

just change the importance of that css rule so it doesn't get overwritten.
.red-background {
color: black;
background-color: red !important;
font-size: 30px;
}
Demo: http://jsfiddle.net/Q77RZ/4/

Related

css hover doesn't work (little code)

i am trying to make a website, but for some reason i am stuck on the hover. I knew how to do this, but i thing i forgot something.
What i want is that when i hover over the black bar the black turns into white so you can see the text.
This is my code:
div.spoiler1:hover div.spoiler1 {
background-color: white;
}
<div style='display:inline; background-color: black;' class='spoiler1'>hey</div>
I also tried this css:
spoiler1:hover spoiler1 {
background-color: white;
}
div.spoiler1:hover,.spoiler1 {
background-color: white;
}
spoiler1:hover {
background-color: white;
}
Good efforts. The issue is that the inline style overrides the sheet. In general, don't use inline styles (hard to debug/maintain, not reusable):
div.spoiler1 {
background-color: black;
display: inline;
}
div.spoiler1:hover {
background-color: white;
}
<div class='spoiler1'>hey</div>
See this JSFiddle.

Background color not changing on hover in WordPress custom css

I am using WordPress so I wrote the custom color to change the background color of the box on hover but it's not working
#project1 {
height: 100px;
width: 33.33%;
background-color: red !important;
}
#project1:hover {
background-color: blue;
color: white;
}
<div id="project1"></div>
The !important rule is not being overwritten by a new rule that does not have !important.
Either remove !important from the first declaration, or if you absolutely have to keep it there, add it also to the :hover declaration.
#project1 {
height: 100px;
width: 33.33%;
background-color: red !important;
}
#project1:hover {
background-color: blue !important;
color: white;
}
<div id="project1"></div>
Try Removing !important from first rule
#project1{
background-color: red;
}
#project1:hover {
background-color: blue;
color: white;
}
Also, tend to avoid putting !important, rather do the override with better combination of parent selectors.

Set a background color to button when clicked using CSS [duplicate]

This question already has answers here:
Can I have an onclick effect in CSS?
(14 answers)
Closed 1 year ago.
How do I set a background color to my <button> when it's clicked using css?
.myBtn {
background-color: #fff;
cursor: pointer;
color: #000;
text-decoration: none;
text-transform: uppercase;
}
html:
<button type="button" class="myBtn">Highlight me when Clicked</button>
Use the active selector for this. Here's a working FIDDLE.
.myBtn:active {
background-color: #dd4814;
}
Check this for reference.
EDIT:
You can use the focus selector also
.myBtn:focus {
background-color: #dd4814;
}
But in this the color will change back again if the focus is lost from the button.
I guess you will need to take the help of Javascript or JQuery for changing the css rules on the click event of the button.
Sorry - but I don't have the rep to comment. But I think this may answer your question: Change background on button click, using CSS only?
EDIT: Oops. That looks like it changes the entire background - but you could probably still use it but change
input[type="checkbox"]:checked + div{
background: #5BC0DE;
}
to target the button by using the button class with something like this:
input[type="checkbox"]:checked + .mybtn{
background: #5BC0DE;
}
Edited answer:
<html>
<head>
<style>
.myBtn:active{
background-color: red;
}
.myBtn:visited{
background-color: red;
}
</style>
</head>
<body>
<button class ="myBtn">Click here to change bgcolor</button>
</body>
</html>
The following code is a snippet of SCSS.
:root {
--b1: beige;
--b2: brown;
--b3: #654321;
}
#check {
display: none;
}
.btn {
background-color: var(--b2);
padding: 5px;
border: 1px solid var(--b3);
font-family: Google Sans;
font-weight: 600;
color: var(--b1);
outline: none;
border-radius: 5px;
cursor: pointer;
}
.btn:hover {
background-color: darken(brown, 5);
border: 1px solid darken(#654321, 10);
}

CSS button with description

I am trying to achieve the following using bootstrap button and custom css. I am not sure how to add a separation with a button and have two sets of labels within it. So far, I am able to create a button with label in it.
Working codeply demo
DEMO
You can do this with mark-up (html) only:
<button>
<h4>Titel</h4>
<hr/>
<span>More</span>
</button>
But this will look a bit weird so by adding some css make it look better.
button span {
font-size: 0.7em;
}
button hr {
margin: 2px;
}
Try this,
Demo
.productButton.selected {
background-color: rgb(0, 146, 143);
color: #FFF;
}
.productBtnText{
font-size:25px;
border-radius:0;
width:100%;
border-bottom:2px solid #000;
}
.productButton{
border:2px solid #000;
margin:0px;
padding:0;
height: 100px;
width: 200px;
font-size: 15px;
white-space: normal;
position: relative;
}

Changing text color on hover using CSS

I've searched but couldn't find anything relating to this problem I'm having.
I have been trying to work this out for ages now but can't seem to do it. I have a div which has text and an image in it. I want all text and background within the div to change color when I hover anywhere within the div. I have made it so that the text at the bottom changes, along with the background color, but can't seem to get the top text (h4) to change color.
It changes color when I hover directly over the h4 element but not when I hover anywhere within the div.
The link below is a rough example of what I want to achieve. There is seperate styling on the CSS of the h4 tag so can't make it a p like the rest. That would be the easiest way to do this but unfortunately they must stay different.
This is my CSS style
.container {
text-align: center;
}
.container h4 {
text-align: center;
color: black;
}
#project1 {
text-align: center;
color: white;
background-color: white;
background-color: rgba(255,255,255,0.9);
color: black;
}
#project1:hover {
background-color: blue;
color: white;
}
#project1 h4:hover {
color: white;
}
#project1 h4 {
text-transform: uppercase;
}
a {
text-decoration: none;
}
Is there any way to do this using CSS and not jquery/javascript? I'm new to Web Development so only know some HTML/CSS at present.
Thanks.
Tom
JSFIDDLE LINK
Change your CSS style from
#project1 h4:hover {
color: white;
}
To
#project1:hover h4 {
color: white;
}
JSFIDDLE DEMO
You can use
#project1 h4 {
color: inherit;
}
to make it inherit #project1's color.
Demo
You can nest h4 tag in p tag.
no need for #project1 h4:hover in CSS.
Demo Fiddle