0

I'm trying to make a flat black background below the navbar but that seems to be an issue. This is particular concern because I wanted to add some JQuery functionality to the buttons on the right to cause the background color to change when they're pressed. But if something as simple as this, though fundamental, doesn't work...

Currently another issue is this thick, white strip. I honestly don't know what's causing it. I assumed that just having a white AlarmTime would mean floating white text on the page surrounded by a black background, but that's clearly not the case. It's left as the default black now simply because it's effectively invisible otherwise. For the record, it's not the flexbox nor the div causing the border because it still shows up with both of them deleted.

https://jsfiddle.net/xjrqm1k3/

    body
{
    background-color:black;
}

What did I do wrong?

Edit: I thought you had to have a period before the name of the selected item to select a class. I guess I might've been missing something in my code? The fiddle I posted doesn't seem to have a period Fiddle, and it's what I Copy-Pasted from my work. Do indents cause Visual Studio to count the item as a class?

Edit: Regardless, thanks for the help and information; it works.

2
  • 1
    Your rule is for a class .body not the body element. However even if you fix that in the fiddle, they're loading your rules first and the Bootstrap CSS after that, so you rules are being overridden.
    – j08691
    Commented Jun 20, 2017 at 19:27
  • Your JSFiddle has a number of errors. You should use external resources to add Bootstrap. I also made some other changes, including the .body to body, and change h1 color so that you can see the heading Clock. See jsfiddle.net/highdown/q4h76xzc.
    – Highdown
    Commented Jun 20, 2017 at 20:30

2 Answers 2

6

You were doing

.body

meaning class with name body

change to body

Also you have to add !important since you're loading bootstrap after this CSS file.

See fiddle

1
  • Yeah I'd put all plugin CSS before your own style
    – BritishSam
    Commented Jun 20, 2017 at 19:39
2

It's probably being overriden by something else. Try this:

    body
    { 
           background-color: black!important; 
    }
4
  • The issue was he was targeting .body not body. Adding !important would do nothing. Commented Jun 20, 2017 at 19:28
  • I don't think body is a class Commented Jun 20, 2017 at 19:29
  • 1
    he needs !important but needed to change .body to body Commented Jun 20, 2017 at 19:30
  • LOL both answers are correct! bootstraps default for body is white so needed to correct the style from .body to body and also needed the important :o) Commented Jun 20, 2017 at 19:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.