0

Hello,

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?

image_gallery.php

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

main.css

table{
border: 1px solid #e2e0e0;
}   

Edited by davy_yg

5
Contributors
4
Replies
26
Views
2 Years
Discussion Span
Last Post by diafol
0

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

0

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

table#adminTable
td {
    border: 1px solid #e2e0e0;
}
0

Hello below css code will give the border to the table

table {
    table-collspace:collspace;
    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

0

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

Example:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
#admin{
    border-collapse:collapse;
}
#admin th, #admin td{
    border: 1px #e2e0e0 solid;
}
</style>
</head>

<body>

<table id="admin">
    <thead>
        <tr>
            <th>Heading One</th>
            <th>Heading Two</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Data content one</td>
            <td>Data content two</td>
        </tr>
    </tbody>
</table>
</body>
</html>

You could even do this:

#admin *{
    border: 1px blue solid;
}

But that's horrible. :)

Edited by diafol

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.