How to show TableRow's border, but not TableCells' - html

I'm working on a dynamically generated table atm. The CSS-File looks like this:
...
td {
border: 1px solid white;
}
tr {
border: 1px solid black;
font-family: Arial;
}
table {
width: 850px;
border-spacing: 8px 8px;
border: 1px solid black;
margin-left: auto;
margin-right: auto;
text-align: center;
}
...
I don't want to see the border of the cells, BUT the cells need to be there, because they are a placeholder, so I change their color to white.
My problem is that I don't know why the border of the rows won't get displayed. Or let's say, is it possible to display the row's border, but not the cells'?

Since different browsers behave differently, where table borders are concerned, I found it always more consistent, to put the borders to the top/bottom of the cells instead of the rows:
td {
border-bottom: 1px solid #000;
}
Since this will draw the top border of each cell, it will look like the row has a border(-bottom).
To add another border to the very top:
tr:first-child td {
border-top: 1px solid #000;
}
Finally, if you need the left and right borders too, add them to the first/last cell of each row:
td:first-child {
border-left: 1px solid #000;
}
td:last-child {
border-right: 1px solid #000;
}
Sorry, if this looks clumsy, but in my experience this will work better than trying to force the rows to display a correct border.

Please try this:
tr {
outline: thin solid black
font-family: Arial;
}

tr{
outline : 1px solid black;
}

Related

Make a grid of divs floated right with parent table div the size of its children

This is my failed attempt:
https://jsfiddle.net/j75hxxa2/1/
I want the block on the right side and the extra gray part gone.
Adding
float: right;
To the parent makes its children very small and tiny. If I try to widen the children by adding
width: 50%;
They break the line.
Is there a simple fix?
(Also I think
margin-top: 1px;
Isn't working?)
Thanks in advance
A better way is to use a table:
HTML:
<table>
<tr><td>Text</td><td>Text</td><td>Text</td><td>Text</td></tr>
<tr><td>I</td><td>II</td><td>III</td><td>IIII</td></tr>
</table>
CSS:
table {
border-collapse: collapse;
background: #000;
border-top: 1px solid #777;
border-left: 1px solid #777;
}
table tr td {
border-right: 1px solid #777;
border-bottom: 1px solid #777;
color: #fff;
}
Add float left to .cell as below, I have changed background color, change it back to your previously assigned or as you wish.
.cell {
width: 24.8%;
float:left;
}
#table {
margin-right: 1px;
margin-top: 1px;
background-color: #f22;
width:100%;
height:37px;
}

overlapping css of a table property with another

I am working on a web page which has a table with several columns as follows
In the above picture each td has blue border but I am trying increase thickness for left border of Ask1 using the following markup and CSS
HTML
<td class="clientOffer1">Ask1</td>
CSS
clientOffer1 {
border-left: 3px solid #0088cc;
}
but above CSS is replaced by the original css of td which is used for remaining columns which is as follows
td {
padding: 1px;
line-height: 10px;
text-align: center;
/*background-color:#3C78B5;*/
vertical-align: auto;
border: 1px solid #0088cc;
width: 120px;
}
How do use both CSS without conflicting one another?
Classes are selected with a leading period in CSS:
.clientOffer1 { ... }
DEMO
td {
padding: 1px;
line-height: 10px;
text-align: center;
/*background-color:#3C78B5;*/
vertical-align: auto;
border: 1px solid #0088cc;
width: 120px;
}
.clientOffer1 {
border-left: 3px solid #0088cc;
}
If you are still having troubles, it would be because some level of specificity is taking hold. Try the following:
.client {
border-left: 3px solid #0088cc !important;
}
Here's some reading material:
Specificity

Border px issue

Currently I have a 1px border that wraps around each job title that I post. The issue that I have is that on the bottoms where i placed the red logo the 1 px's overlap making a thicker line (2px) than the rest. How can I fix this but still have a full border when each page is opened. Thanks for taking a look.
http://jobspark.ca/job-listings/
UPDATED CSS
article .post {
border: 1px solid #e3e3e3;
border-top: none;
}
article.article-index-null .post,
article.article-index-1 .post {
border-top: 1px solid #e3e3e3;
}
UPDATE:
Only thing is now when you click and open a page "parts person" for example the top border is missing. http://jobspark.ca/job-listings/2013/6/3/wellsite-trailer-energy-services-technician
Just remove the top border from each post except the first one:
article .post {
border: 1px solid #e3e3e3;
border-top: none;
}
article .post:first-child {
border-top: 1px solid #e3e3e3;
}
Edit: Because your html structure has a series of article elements with one .post in each (instead of a series of .post elements inside an article, as I'd assumed), the above code won't work, but the principle is the same. You can't use article:first-child because there is another sibling element that is the first child, but since you have given the first article a specific class name, you can use that, as follows:
article .post {
border: 1px solid #e3e3e3;
border-top: none;
}
article.article-index-1 .post {
border-top: 1px solid #e3e3e3;
}
Second Edit: Since you are reusing the same html on for both item view and list view but don't want the top border removed in item view, do the following:
article .post {
border: 1px solid #e3e3e3;
}
.view-list article post {
border-top: none;
}
.view-list article.article-index-1 .post {
border-top: 1px solid #e3e3e3;
}
Alternatively, since in your unit view you have given the article the class "article-index-null" you could also do the following:
article .post {
border: 1px solid #e3e3e3;
border-top: none;
}
article.article-index-null .post,
article.article-index-1 .post {
border-top: 1px solid #e3e3e3;
}
Either one should work.
Change to this:
article .post {
padding: 12px 16px;
border: 1px solid #e3e3e3;
border-bottom: none;
background: white;
}
And add this:
article .post:last-child {
border-bottom: 1px solid #e3e3e3;
}
There are a few ways to do this. i would wrap the entire articles section with a <div> that has only a 1px top border, no padding. then every article would only need left, right and bottom borders to achieve the look you are going for.
article .post {
padding: 12px 16px;
border-left: 1px solid #e3e3e3;
border-right: 1px solid #e3e3e3;
border-bottom: 1px solid #e3e3e3;
background: white;
}
Instead of using border what about using border-left border-right and border top ?
Seems like this is solving your issue.

<tr> border top working but not border bottom

Here's the issue. I have my code so that I should be seeing a border on top and bottom of each <tr> item. However, I only see what's on bottom except for the top element.
.tstyle1 {
margin: 10px 0 0 30px;
width: 950px;
}
.tstyle1 tr {
height: 120px;
border-bottom: 1px solid black;
border-collapse: separate;
border-top: 1px solid black;
border-bottom: 1px solid orange;
}
.tstyle1 td {
border: none;
}
Here's the issue recreated.
http://jsfiddle.net/fL3rx/
Try
adding display: block; to your .tstyle1 tr
The issue is that your border-bottom definition is simply covering your border-top definition. So the color beneath does not show. Try setting the border-bottom:none and you'll see the top border shows
The suggestion by #Pricey did some magic though.

Outline table row on hover

I am trying to highlight the border of a table row on hover. Unfortunately this only works for the first row of cells. Lower rows have one border that does not change color. I have tried using outline but it doesn't play nice with :hover in webkit.
http://jsfiddle.net/S9pkM/2/
Imagine your standard table html. Some tr's with some td's. Hovering over a row should highlight its border in red.
table { border-collapse: collapse; } /*I am aware of separate */
table td { border: 3px solid black; }
table tr:hover td { border-top-color: red; border-bottom-color: red; }
table tr:hover td:first-child { border-left-color: red; }
table tr:hover td:last-child { border-right-color: red; }
I am open to alternate approaches, but I am stuck with the table structure. No inserting additional html besides standard <table> <tr> <td>
I've been facing this same problem and finally found a simpler solution here.
You can use this CSS trick ( border-style: double; ) that works for 1px borders:
#mytable tr.row:hover td
{
border-style: double;
border-color: red;
}
This will make your border-color work (be the top most one) no matter what. :-)
For 1px borders see Leniel's solution that uses border-style: double. This is much simpler. A double border is one that shows a 1px line for the inside and outside edges of the border. This doesn't do anything for a 1px border, but on >1px there is a gap.
For borders >1px you remove the bottom border for all of the <td>'s with border-bottom: 0. The top borders of the other cells will keep everything looking the way they should, except for the last row. The last row we fix with tr:last-child td { border-bottom: your border style }. Finally in your hover pseudoclass you set the bottom border.
http://jsfiddle.net/S9pkM/16/
table { border-collapse: collapse; } /*I am aware of separate */
table td { border: 1px solid black; width: 50px; height: 25px; padding: 5px; border-bottom: 0; }
table tr:last-child td { border-bottom: 1px solid black; }
table tr:hover td { border-top-color: red; border-bottom: 1px solid red; }
table tr:hover td:first-child { border-left-color: red; }
table tr:hover td:last-child { border-right-color: red; }
why not to use separate border?
http://jsfiddle.net/S9pkM/6/
Just put this code into your head section:
<style>
table td { border: 2px solid transparent; width: 50px; height: 50px; padding: 5px 5px 5px 5px;}
table td:hover {border:2px solid red; }
</style>