Cals table styling - html

I have the below HTML table (cals table), here I need some CSS which shows the output as in the screenshot (the borders part).
<div class="para">To the Commissioner for Labour</div>
<table class="frame-all" colsep="1" rowsep="1" align="left" cols="4">
<colgroup>
<col class="colname-c1 colwidth-25.00%"></col>
<col class="colname-c2 colwidth-25.00%"></col>
<col class="colname-c3 colwidth-25.00%"></col>
<col class="colname-c4 colwidth-25.00%"></col>
</colgroup>
<tbody>
<tr>
<td colspan="4" align="">
I declare that the information given in this form is, to the
best of my knowledge, true and accurate.Signature: ___________
(for and on behalf of the employer)Name (in block letters): ____
</td>
</tr>
<tr>
<td>
<div class="para">Position:</div>
</td>
<td>
<div class="para">□ Sole proprietor</div>
</td>
<td>
<div class="para">□ Partner</div>
</td>
<td>
<div class="para"></div>
</td>
</tr>
<tr>
<td>
<div class="para"></div>
</td>
<td>
<div class="para">□ Manager</div>
</td>
<td>
<div class="para">□ Officer</div>
</td>
<td>
<div class="para"></div>
</td>
</tr>
<tr>
<td colspan="2" align="">Date: __________________________</td>
<td>
<div class="para"></div>
</td>
<td>
<div class="para">__________________________________</div>
<div class="para">Chop of Company <span class="font-style-bolditalic">(Note 1)</span>
</div>
</td>
</tr>
</tbody>
</table>
<div class="para align-center"><span class="font-style-bold">Part I</span></div>
<div class="para"> <span class="font-style-italic">A. Particulars of the employee</span>
</div>
<table class="frame-all" colsep="1" rowsep="1" align="left" cols="4">
<colgroup>
<col class="colname-c1 colwidth-25.00%"></col>
<col class="colname-c2 colwidth-25.00%"></col>
<col class="colname-c3 colwidth-25.00%"></col>
<col class="colname-c4 colwidth-25.00%"></col>
</colgroup>
<tbody>
<tr>
<td colspan="3" align="">Name of employee (Surname first)</td>
<td>
<div class="para">Identity Card/Passport No.</div>
</td>
</tr>
<tr>
<td>
<div class="para">Telephone No.</div>
</td>
<td>
<div class="para">Fax No.</div>
</td>
<td colspan="2" align="">Address</td>
</tr>
<tr>
<td>
<div class="para">Date of birth</div>
<div class="para">_____/_____/____</div>
<div class="para">Day/Month/Year</div>
</td>
<td>
<div class="para">Sex</div>
<div class="para">□ Male □ Female</div>
</td>
<td>
<div class="para">Occupation</div>
</td>
<td>
<div class="para">An apprentice</div>
<div class="para">□ Yes □ No</div>
</td>
</tr>
</tbody>
</table>
the expected and current outputs are as below
Current:
Expected:
Thanks

To display borders around the table:
table {
border: 1px solid;
}
To prevent borders around the cells (td):
table td {
border: none;
}
To align the text to the left and to add some spacing:
table td {
padding: 3px;
text-align: left;
}
You can style the second table based on the example I have provided for the first.
Example: http://jsfiddle.net/KTZL6/1
This, however, is very basic css. You're probably best off working through a tutorial like http://www.cssbasics.com/introduction-to-css/ to get a grasp of it.

If i understand right you only want remove borders.
<table class="frame-all" colsep="1" rowsep="1" align="left" cols="4" border="0">
You can use border="0", No need and external css file
http://www.w3schools.com/cssref/playit.asp?filename=playcss_border-style&preval=none for other border properties

Related

How to fixed the td width in table

I use easyui-panel with one table in my project.
I want to fixed each td width:50px;
Here is my code:
<div class="easyui-panel" id="pp" style="margin-top:30px;width:100%">
<table class="uTbId" cellspacing="0" style="width:100%" >
<tr>
<td style="position:absolute;width:50px;background-color:#fafafa">stack</td>
<td style="position:absolute;width:50px;background-color:#fafafa">john</td>
<td style="position:absolute;width:50px;background-color:#fafafa">stock</td>
<td style="position:absolute;width:50px;background-color:#fafafa">shansa</td>
</tr>
<tr>
<td style="postion:absolute;width:50px;background-color:#fafafa">Joy</td>
</tr>
</table>
</div>
But it works fail. stack,john and stock are disappear. My table is in an abnormal stat.
When I deleted "position:absolute;width:50px;", all names can be show.like:
<div class="easyui-panel" id="pp" style="margin-top:30px;width:100%">
<table class="uTbId" cellspacing="0" style="width:100%" >
<tr>
<td style="background-color:#fafafa">stack</td>
<td style="background-color:#fafafa">john</td>
<td style="background-color:#fafafa">stock</td>
<td style="background-color:#fafafa">shansa</td>
</tr>
<tr>
<td style="background-color:#fafafa">Joy</td>
</tr>
</table>
</div>
All names can appear without fixed width, but it is not what i want.
Who can help me ?
You don't need to remove both position:absolute and width:50px.
Removing position:absolute and the width:100% from the <table> should result in what you want. So now your HTML looks like
<div class="easyui-panel" id="pp" style="margin-top:30px;width:100%">
<table class="uTbId" cellspacing="0">
<tr>
<td style="width:50px;background-color:#fafafa">stack</td>
<td style="width:50px;background-color:#fafafa">john</td>
<td style="width:50px;background-color:#fafafa">stock</td>
<td style="width:50px;background-color:#fafafa">shansa</td>
</tr>
<tr>
<td style="width:50px;background-color:#fafafa">Joy</td>
</tr>
</table>
If it doesn't result in what you want, it is possible that some CSS styles are adding additional padding or margins to the <td> element. Fire up the developer console (F12 on most browsers) -> right click on your element -> Inspect and in the CSS styles part look at the box model to find out if there is any additional padding/margins being applied
You can set your HTML talbe to be fixed width, then specify column widths:
<div class="easyui-panel" id="pp" style="margin-top:30px;width:100%">
<table class="uTbId" cellspacing="0" style=" table-layout:fixed;" >
<col width="5px" />
<col width="5px" />
<col width="5px" />
<col width="5px" />
<col width="5px" />
<tr>
<td style="background-color:#fafafa">stack</td>
<td style="background-color:#fafafa">john</td>
<td style="background-color:#fafafa">stock</td>
<td style="background-color:#fafafa">shansa</td>
</tr>
<tr>
<td style="background-color:#fafafa">Joy</td>
</tr>
</table>
</div>
https://jsfiddle.net/56Lc4o44/
When I use unified format, It works OK
The code is:
<style>
.uTbId tr td{width:100px;background-color:#fafafa}
.uTbId tr td:hover{background-color:#0000CD;color:green;}
</style>
<div class="easyui-panel" id="pp" style="margin-top:30px;width:100%">
<table class="uTbId" cellspacing="0" style="width:100%" >
<tr>
<td >stack</td>
<td >john</td>
<td >stock</td>
<td >shansa</td>
</tr>
<tr>
<td>Joy</td>
</tr>
</table>

Mailchimp applies the table's border in the whole template design

Mailchimp is so frustrating. I'm trying to make a campaign with the template that I did. It's supposed to look like this:
BUT when I'm trying to paste a table that I copied from google sheets, it's looking like this
How do I fix it? How can I make the borders disappear every time I'm going to paste a table?
If you're wondering this is the source code (I removed the content because it's classified and it exceeded the 30,000 characters limit):
<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}-->
</style>
<table border="1" cellpadding="0" cellspacing="0" dir="ltr">
<colgroup>
<col width="277" />
<col width="100" />
<col width="100" />
<col width="113" />
<col width="114" />
<col width="49" />
<col width="79" />
<col width="2" />
<col width="100" />
<col width="100" />
</colgroup>
<tbody>
<tr>
<td data-sheets-value="{"1":2,"2":"AS OF: 8/29/16"}">AS OF: 8/29/16</td>
<td colspan="6" data-sheets-value="{"1":2,"2":"DIGITAL CARDS / CODES\n Official Pins or Scans with Text"}" rowspan="1">DIGITAL CARDS / CODES<br />
Official Pins or Scans with Text</td>
<td> </td>
<td colspan="2" data-sheets-value="{"1":2,"2":"PHYSICAL CARDS\n Free shipping on 500+ units"}" rowspan="1">PHYSICAL CARDS<br />
Free shipping on 500+ units</td>
</tr>
<tr>
<td> </td>
<td colspan="2" data-sheets-value="{"1":2,"2":"< 100 Units"}" rowspan="1">< 100 Units</td>
<td colspan="2" data-sheets-value="{"1":2,"2":"100+ Units\n Call/Email for pricing on 1000+ units per item"}" rowspan="1">100+ Units<br />
Call/Email for pricing on 1000+ units per item</td>
<td colspan="2" data-sheets-value="{"1":2,"2":"Format"}" rowspan="1">Format</td>
<td> </td>
<td colspan="2" data-sheets-value="{"1":2,"2":"Call/Email for pricing\n on 1000+ units per item"}" rowspan="1">Call/Email for pricing<br />
on 1000+ units per item</td>
</tr>
<tr>
<td> </td>
<td data-sheets-value="{"1":2,"2":"Unit Cost"}"> </td>
<td data-sheets-value="{"1":2,"2":"% Off MSRP"}"> </td>
<td data-sheets-value="{"1":2,"2":"Unit Cost"}"> </td>
<td data-sheets-value="{"1":2,"2":"% Off MSRP"}"> </td>
<td data-sheets-value="{"1":2,"2":"Pins"}"> </td>
<td data-sheets-value="{"1":2,"2":"Scans + Text"}"> </td>
<td> </td>
<td data-sheets-value="{"1":2,"2":"Unit Cost"}"> </td>
<td data-sheets-value="{"1":2,"2":"% Off MSRP"}"> </td>
</tr>
<tr>
<td data-sheets-numberformat="[null,4,"\"$\"#,##0",1]" data-sheets-value="{"1":3,"3":10}"> </td>
<td data-sheets-numberformat="[null,4,"\"$\"#,##0.00",1]" data-sheets-value="{"1":3,"3":9.15}"> </td>
<td data-sheets-numberformat="[null,3,"0.00%",1]" data-sheets-value="{"1":3,"3":0.085}"> </td>
<td data-sheets-numberformat="[null,4,"\"$\"#,##0.00",1]" data-sheets-value="{"1":3,"3":9.1}"> </td>
<td data-sheets-numberformat="[null,3,"0.00%",1]" data-sheets-value="{"1":3,"3":0.09}"> </td>
<td data-sheets-value="{"1":2,"2":"\u25cf"}"> </td>
<td> </td>
<td> </td>
<td data-sheets-numberformat="[null,4,"\"$\"#,##0.00",1]" data-sheets-value="{"1":3,"3":9.1}"> </td>
<td data-sheets-numberformat="[null,3,"0.00%",1]" data-sheets-value="{"1":3,"3":0.09}"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td data-sheets-numberformat="[null,4,"\"$\"#,##0",1]"> </td>
<td data-sheets-numberformat="[null,4,"\"$\"#,##0.00",1]"> </td>
<td data-sheets-numberformat="[null,3,"0.00%",1]"> </td>
<td data-sheets-numberformat="[null,4,"\"$\"#,##0.00",1]"> </td>
<td data-sheets-numberformat="[null,3,"0.00%",1]"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
table border applied change border="0"
<table border="0" cellpadding="0" cellspacing="0" dir="ltr">
Step 1: set each <table> to border="0"
<table border="0" cellpadding="0" cellspacing="0" dir="ltr">
Step 2: delete the commented-out td {border: 1px solid #ccc;}
You should now have no borders anywhere, so go back and add only the borders you want with inline styles on either <td>s (best) or <table>s. Eg:
<table border="0" cellpadding="0" cellspacing="0" dir="ltr">
<tr>
<td style="border-top: 1px solid #ffffff;">
content
</td>
</tr>
</table>
This should produce an email with no unintentional borders anywhere. I'm not sure what pasting from Google Sheets is like, but you'll want to edit the HTML in this way to make sure it displays correctly.

Table Cells with different widths in different rows

I am weak in CSS, and I am trying to put a table in my html page, it has two rows and five columns per row(of course it is simplified), and it should look like this (the table is a hand-drawing table, it does not come so precise, I`m sorry for that.):
But mine looks like this:
This is my code:
<table border="1">
<tr>
<td style="width:50px" colspan="2"> </td>
<td style="width:50px" colspan="2"> </td>
<td style="width:50px" colspan="2"> </td>
<td style="width:50px" colspan="2"> </td>
<td style="width:25px"> </td>
</tr>
<tr>
<td style="width:25px"> </td>
<td style="width:50px" colspan="2"> </td>
<td style="width:50px" colspan="2"> </td>
<td style="width:50px" colspan="2"> </td>
<td style="width:50px" colspan="2"> </td>
</tr>
</table>
Code in jsfiddle is here.
NOTE:Any styles could be added, but structure of table could not be changed.
My problem is not the border style of table, but the width of cells, it seems that cells has a erratic width, I hope the right-border of first cell in second row could reach to the middle of bottom-border of first cell in first row, and the right-border of first cell in first row could reach to the middle of top-border of second cell in second row, so is others.
I have tried my best, but it still does not work. How could I do to match the requirement? Any suggestion will be appreciated. Thanks in advance.
You can use a <colgroup> element to achieve this:
<table border="1">
<colgroup>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
<col style="width: 25px"/>
</colgroup>
<tr>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
</tr>
</table>
It will tell the table that there are 9 columns and each row will span the columns as you originally had.
There are other non-table ways to acheive what you are looking for. Here is one quick example:
<div>
<div class="row">
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
</div>
<div class="row">
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
</div>
</div>
div.row
{
clear:both;
}
div div div
{
width: 50px;
border-width: 1px;
border-style: solid;
border-color: black;
display: inline-block;
float: left;
margin: -1px;
}
div div:nth-child(2n+1) div:first-child,
div div:nth-child(2n) div:last-child
{
width: 25px;
}
Use tables within tables..
<table>
<tr>
<td>
<table border="1">
<tr>
<td style="width:50px"> </td>
<td style="width:50px"> </td>
<td style="width:50px"> </td>
<td style="width:50px"> </td>
<td style="width:25px"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="1">
<tr>
<td style="width:25px"> </td>
<td style="width:50px"> </td>
<td style="width:50px"> </td>
<td style="width:50px"> </td>
<td style="width:50px"> </td>
</tr>
</table>
</td>
</tr>
</table>
This way you will never have that problem...
For this to work, you need to have at least one row that defines the width of individual cells (ones that are not using cellspans):
http://jsfiddle.net/cR2qd/7/1
HTML:
<body>
<table border="1">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
</tr>
</table>
</body>
CSS:
td {
width: 25px;
}

Why my html table is getting out of my div?

I have a html table inside a div but the table is getting out of the div's width, here is what I am doing:
<div style="width: 920px">
<table style="width: 100%;">
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</div>
this is not working
You have an empty layout so there is nothing to see. If you add height, you can see how it looks:
<div style="width: 920px;border:1px solid red;height:500px;">
<table style="width: 100%;" border="1">
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</div>​
EXAMPLE
Try adding some attributes to the table to ensure there is no cell spacing:
<table style="width: 100%;" border="0" cellspacing="0" cellpadding="0">

hiding nth child tr

Apologize for the length of the code. I'm trying to hide the three cells that contain the $ I can't change the html but I can change the CSS. I've tried:
.extra-details table:nth-child(1) tr:nth-child(-n+4)
but that gets the first 4 rows in the second table as well. So my question is this, is there CSS I can use to hide the cell/rows that have the $ or suggestions on something to search for? cell values have been removed for brevity.
<div class="details_column">
<div class="column">
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
</td>
<td class="medium ">
</td>
</tr>
<tr>
<td>
Price
</td>
<td class="medium ">
$
</td>
</tr>
<tr>
<td>
</td>
<td class="medium ">
$
</td>
</tr>
<tr>
<td>
</td>
<td class="medium ">
$
</td>
</tr>
<tr>
<td>
</td>
<td class="medium ">
</td>
</tr>
<tr>
<td>
</td>
<td class="medium ">
</td>
</tr>
<tr>
<td>
</td>
<td class="medium ">
</td>
</tr>
<tr>
<td>
</td>
<td class="medium ">
</td>
</tr>
</tbody>
</table>
</div>
<div class="column">
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
</td>
<td class="medium ">
</td>
</tr>
<tr>
<td>
</td>
<td class="medium ">
</td>
</tr>
<tr>
<td>
</td>
<td class="medium ">
</td>
</tr>
<tr>
<td>
</td>
<td class="medium ">
</td>
</tr>
<tr>
<td>
</td>
<td class="medium ">
</td>
</tr>
<tr>
<td>
</td>
<td class="medium ">
</td>
</tr>
<tr>
<td>
</td>
<td class="medium ">
</td>
</tr>
<tr>
<td>
</td>
<td class="medium">
</td>
</tr>
</tbody>
</table>
</div>
</div>
In a single line the CSS to select just the <td> containing $ elements would be:
div.column:first-child table tr:nth-child(-n+4):not(:nth-child(1)) td:last-child {
border:2px dashed red;
}
as demonstrated in this fiddle. However, please note that this is only tested in Chrome.
To select a specific first occurrence of an element, use :first-of-type instead of :first-child. With the given structure, the following selector can be used to achieve your goal:
.details_column > *:first-of-type table tr:nth-child(2) td,
.details_column > *:first-of-type table tr:nth-child(3) td,
.details_column > *:first-of-type table tr:nth-child(4) td {
background:red;
}
Fiddle: http://jsfiddle.net/BaUYF/
Explanation of CSS:
Select any element with class details_column
Select the any element which is a first typem and contains a <table> child.
Select the 2nd, 3rd and 4th row. of these tables.
Select all cells in these rows
Apply a style
Note: The proposed selectors could be adjusted to match your exact wishes. I haven't used it, but the :not() selector could also be useful.