I am trying to place border colors around the whole table including inside the tables. Yet, what happen is the border only appears outside the table like a box. There are no borders inside the table. How to place borders including inside the tables?


<!-- border="1" -->
                <table style="margin: 50px 0 0 -150px; position: relative;" id="admintable"  cellpadding="2" cellspacing="0">


border: 1px solid #e2e0e0;

just go with

#admin {
    border: 1px solid #f6f6f6;

Seeing as you have already specified an ID you don't need to include the table selector. It means the CSS is trying to style a table that is a child of #admin

I think you may want to style the <td> borders instead of the <table> borders to get what you're looking for. So:

td {
    border: 1px solid #e2e0e0;

Hello below css code will give the border to the table

table {
    border:1px solid #e2e0e0;

if you want to give borders to td you can do the following

table td {
    border:1px solid #e2e0e0;

Hope this will help you out

Member Avatar for diafol

If you have a semantic table: <tbody> with <td> and <thead> with <th> - don't forget to include the th in your css.


<meta charset="utf-8">
<title>Untitled Document</title>
#admin th, #admin td{
    border: 1px #e2e0e0 solid;


<table id="admin">
            <th>Heading One</th>
            <th>Heading Two</th>
            <td>Data content one</td>
            <td>Data content two</td>

You could even do this:

#admin *{
    border: 1px blue solid;

But that's horrible. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.