user2326844
user2326844

Reputation: 321

The css file does not change the tables in html file

This is a css text, I want to give all the tables in html pages a border with width 1px. But the html files are not reading this why? I can't see any borders in html files!!!!

<!-- <style type="text/css"> -->
body{background-color:pink;
}
input{background-color:green;
font-color=blue;
}


table.center {
    margin-left:auto; 
    margin-right:auto;
    border-width:10px solid;

  }
.testext{color:gray};
<!-- </style> -->

Upvotes: 0

Views: 116

Answers (3)

Adrift
Adrift

Reputation: 59799

Well you have two issues:

1) The property is not font-color its color and you have an = instead of a : between the property and its value which will cause that rule to be ignored

2) You should instead use the border shorthand, as you're specifying two different properties using the border-width property which obviously only accepts a single <length> value, instead change to:

border: 10px solid black;

To gain a better understanding of CSS syntax, read the syntax module

Upvotes: 4

Dan
Dan

Reputation: 184

You need to separate the border styles. 'solid' is not a valid value of border-width. E.g. To produce a 10px width border:

table.center {
    margin-left:auto; 
    margin-right:auto;
    border-width:10px;
    border-style: solid;
}

or combine like this:

table.center {
    margin-left:auto; 
    margin-right:auto;
    border: 10px solid;
}

Upvotes: 0

Joe Ratzer
Joe Ratzer

Reputation: 18549

Change

table.center {
    margin-left:auto; 
    margin-right:auto;
    border-width:10px solid;

  }

to

table {
    border: solid 10px #000;

  }
table.center {
    margin-left:auto; 
    margin-right:auto;
  }

Assuming you'd done the border correctly, table.center would only apply to tables with the class name 'center'

Upvotes: 1

Related Questions