Kane
Kane

Reputation: 21

Css background colour not working

Hello I am creating a website and I can't here is my code:

body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 18px;
  background-color: ffffff;
  overflow: auto;
}
<body>
  <div class="main">
    <img src=images\cat.gif></img>
    <table class="table">
      <tr>
        <th style="text-align:left;">
          <p id="output"><b>Likes: 0</b> 
          </p>
        </th>
        <th style="text-align:right;">
          <button class="button" onclick="likeButton()">Like</button>
        </th>
      </tr>
    </table>
    <script src="script.js"></script>
  </div>
</body>

I have now idea what is wrong all of the guides I've seen have fixed syntax errors but I've triple checked and I am almost sure I don't have any plus on other documents I have the same issue. I may just be bad. Thanks...

Upvotes: 0

Views: 1702

Answers (10)

Dipak Thoke
Dipak Thoke

Reputation: 1983

First thing write "#" in front of background color code. eg:#ffffff Second thing #ffffff this color code is for white color if want see the difference, please change this color code to #FF0000

body {
        font-family: "Segoe UI",Tahoma,sans-serif;
        font-size: 18px;
        background-color: #ffffff;   // white color    please replace this to "#FF0000"  inoder to see the difference 
        overflow: auto;
    }

Upvotes: 1

Aswathy
Aswathy

Reputation: 211

There is no compulsory rule to put # symbol before on color .In this, Kane's code is correct.But background-color: ffffff;return white color.ie.ffffff means white color. So we can not find any background in the website.If you have any doubt you change your background -color as background-color: FF0000; then you can clear your doubt.

Upvotes: 1

satwick
satwick

Reputation: 139

body {
font-family: "Segoe UI",Tahoma,sans-serif;
font-size: 18px;
background-color: #ffffff;
overflow: auto;
}

First You Learn Css

if you forgot to put # symbol in front of color code,css does not apply to it ,and #ffffff color RGB value is (255,255,255). This hex color code is also a web safe color which is equal to #FFF. #ffffff color name is White color.

Upvotes: 2

Rizwan Mughal
Rizwan Mughal

Reputation: 48

You have missed # in background-color: ffffff; correct it by adding # like

background-color: #ffffff;

white is by default background color of browser. you can test it by changing with #ffbf00, #4000ff etc

Recommended read it from here

Upvotes: 1

Roma
Roma

Reputation: 282

As #FFFFFF is white color. so you will not see it so change color and check

body {
        font-family: "Segoe UI",Tahoma,sans-serif;
        font-size: 18px;
        background-color: #FF0000;
        overflow: auto;
    }
<body>
    <div class="main">
        <img src=images\cat.gif></img>
        <table class="table">
            <tr>
                <th style="text-align:left;"><p id="output"><b>Likes: 0</b>        </p></th>
                <th style="text-align:right;"><button class="button" onclick="likeButton()">Like</button></th>
            </tr>
        </table>
        <script src="script.js"></script>
    </div>
</body>

Upvotes: 1

yash
yash

Reputation: 2291

in body css , there's missing #(hash) symbol before color code,
below code may work.

 body {
        font-family: "Segoe UI",Tahoma,sans-serif;
        font-size: 18px;
        background-color: #ffffff;
        overflow: auto;
    }

here is jsfiddle link , you can check here too, it's working jsfiddle

and reason behind image not displaying is that , you did not double quote src value. like src="images\cat.gif"

Upvotes: 2

sps
sps

Reputation: 80

'#' is missing in your code. If you setting background-color anywhere else use '!important'

body {
    font-family: "Segoe UI",Tahoma,sans-serif;
    font-size: 18px;
    background-color: #ffffff !important;
    overflow: auto;
}

Upvotes: 1

Maciej Wojcik
Maciej Wojcik

Reputation: 2171

You have to delete </img> and add " in src Please have a look to this: code

Upvotes: 0

ItzMe_Ezhil
ItzMe_Ezhil

Reputation: 1406

CSS changes:

     body {        
    background-color:#ffffff;       
     }

Upvotes: 1

Samudrala Ramu
Samudrala Ramu

Reputation: 2106

 body {
    font-family: "Segoe UI",Tahoma,sans-serif;
    font-size: 18px;
    background-color: #ffffff;
    overflow: auto;
}

Try This

Upvotes: 3

Related Questions