Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Bear with me very new to html and css. I can draw normal table but not like this I have mentioned.
I'll throw you a bone since you say you're new.
table, td {
border:1px solid #999;
}
<table>
<tr>
<td rowspan="2"> </td>
<td colspan="4"> </td>
<td rowspan="2"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<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>
</tr>
<tr>
<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>
</tr>
</table>
You need to use rowspan & colspan properties in the elements. For e.g
To draw a structure like this :
The code will be
<table class="" border=1px style="width: 40%">
<tr>
<td rowspan="2" colspan="2">Puma</td>
<td colspan="4">adidas</td>
</tr>
<tr>
<td colspan="4">superdry</td>
</tr>
<tr>
<td rowspan="2"> john player </td>
<td rowspan="2"> biba </td>
<td rowspan="2"> bagit </td>
<td> jack&jones </td>
</tr>
<tr>
<td> peter england </td>
</tr>
<tr>
<td rowspan="2"> us polo </td>
<td rowspan="2"> Global desi </td>
<td rowspan="2"> levis </td>
<td rowspan="2"> spykar </td>
</tr>
</table>
[1]: http://i.stack.imgur.com/Y9TTK.png
There are parameters called "rowspan" and "colspan" which give you what you are looking for.
http://www.w3schools.com/Html/tryit.asp?filename=tryhtml_table_span
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I want to create table in HTML with 10 rows. Table must be static one like below image, whether data is there or not table layout should not change. Any solutions in HTML-CSS or JS or Bootstrap-4 or PHP or Ajax are welcomed.
Example with some added css on td with a border to show that the table rows exist:
td {
border: 1px solid black
}
<table>
<tr>
<th>First name</th>
<th>Last name</th>
<th>Email</th>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
<td>john#example.com</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
I have to make a complex and painful painting to put in place then that I take receive a collection of data with which I generate the table
I have under Laravel a data collection that I have to present as the attached image. Please help me build a picture similar to the picture:
<table>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" rowspan="2"> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" rowspan="2"> </td>
<td> </td>
</tr>
</table>
I think what you want is a complex header. Look here, hoping it helps.
<table id="example" style="width:100%">
<thead>
<tr>
<th rowspan="2"> </th>
<th colspan="2">Maths</th>
<th colspan="3">French</th>
<th colspan="2">Sport</th>
</tr>
<tr>
<th>Ex1</th>
<th>Ex2</th>
<th>Ex1</th>
<th>Ex2</th>
<th>Ex3</th>
<th>Ex1</th>
<th>Ex2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Johnson</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Franck</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I need to build a complex table in HTML for schedule web-application.
It should looks like so:
http://s7.postimg.org/f3m25bnuj/schedule_layout.jpg
How can I achieve this in HTML?
Which approach is best to build such a table?
Is "Bootstrap" CSS framework capable to do that too?
My table will have more than 12 columns
That is a pretty complex table. I would recommend that you use some visual tools (like Dreamweaver) to draw this table. Trying such complex table by code is possible but its very time consuming and could result in errors that might have to re-check and redo. Bootstrap has style definitions that you can apply to a table, but trying this particular table via bootstrap css is possible but time consuming. check this jsfiddle: https://jsfiddle.net/brijeshb/zn9eo7uu/
<table width="80%" border="1" cellspacing="1" cellpadding="2">
<tr>
<td width="8%"> </td>
<td width="8%"> </td>
<td width="8%"> </td>
<td width="14%"> </td>
<td width="5%"> </td>
<td width="8%"> </td>
<td width="8%"> </td>
<td width="8%"> </td>
<td width="8%"> </td>
<td width="8%"> </td>
<td width="8%"> </td>
<td width="9%"> </td>
</tr>
<tr>
<td rowspan="21"> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
<td> </td>
<td rowspan="10"> </td>
<td> </td>
<td> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
<td> </td>
<td> </td>
<td> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
<td> </td>
<td rowspan="5"> </td>
<td> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
<td rowspan="5"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<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>
<td> </td>
</tr>
<tr>
<td> </td>
<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>
<td> </td>
</tr>
<tr>
<td> </td>
<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>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
what have you tried so far? tables would not be recommended for layout purposes and it really depends on a few things for example, does you app need to be responsive? what data would each "box" display? pictures?.
If I were you I would try to use some grid system to start with but the table approach would be too messy and not suitable for creating a layout of that kind.
Yes, you can achieve this in HTML by using colspan and rowspan attributes.
You should use table element only.
"Bootstrap" framework should be used in order to achieve the responsive design.
In smaller screens like ipad, mobile devices, use the following library to avoid distortion.
http://fooplugins.com/plugins/footable-jquery/
Table with spaces that I'm trying to get in the middle
How do I get blank spaces in my table? I want to get it to look like the image above, but I want those empty spaces to be in the middle of the table rather than on the side.
<table style="width:100%" border="1" cellpadding="10">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td> <!-- Added to show the kind of space I want in the table -->
</tr>
<tr>
<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>
</tr>
<tr>
<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>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
I'm not sure what I'm doing wrong here. I've looked up several different things but none of them seem to tell me exactly what I'm supposed to do.
I'd try to approach this using CSS instead of a border attribute on the parent table. As is, you're setting a border on every cell in the table, and you want to pick whether or not you're going to show a border on a per-cell basis.
Basically, I'd:
<style type="text/css">
.borderedTable tr td {
border: solid 1px black;
}
.tableCellWithoutBorder {
border-width: 0px;
}
</style>
<table cellpadding="10" class="borderedTable">
<tr>
<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 class="tableCellWithoutBorder"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td class="tableCellWithoutBorder"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td class="tableCellWithoutBorder"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td class="tableCellWithoutBorder"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td class="tableCellWithoutBorder"> </td>
</tr>
</table>
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I have a to present data in html with headers. Below is the image of part of the header which i am struggling with.
I have managed to rotate the text but the problem is there overlap.
This is the code of the whole structure.
<style type="text/css"> .text-rotation {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
height:inherit;
}
</style>
</head>
<body>
<table width="100%" border="1" align="center" cellpadding="3" cellspacing="1">
<tr>
<td rowspan="5"> </td>
<td rowspan="5" align="center" valign="bottom">Code</td>
<td rowspan="5" align="center" valign="bottom">Change</td>
<td rowspan="5" align="center" valign="bottom">Description</td>
<td colspan="6" align="center" bgcolor="#FF6666">STOCK RANGE</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#66CC00" >SPHERICAL</td>
<td colspan="2" align="center" bgcolor="#FFCC00" >SPH/CYL-/-</td>
<td colspan="2" align="center" bgcolor="#0066CC">SPH/CYL+/-</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td rowspan="3" align="center" bgcolor="#66CC00" class="text-rotation">MINUS</td>
<td rowspan="3" align="center" bgcolor="#66CC00" class="text-rotation">PLUS</td>
<td rowspan="3" align="center" bgcolor="#FFCC00" class="text-rotation">MINUS</td>
<td rowspan="3" align="center" bgcolor="#FFCC00" class="text-rotation">PLUS</td>
<td rowspan="3" align="center" bgcolor="#0066CC" class="text-rotation">PLUS</td>
<td rowspan="3" align="center" bgcolor="#0066CC" class="text-rotation">MINUS</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<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>
<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>
<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>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
A quick mock-up:
<table border="1">
<tr>
<td colspan="6">STOCK RANGE</td>
<td colspan="11">LENS PROPERTIES</td>
</tr>
<tr>
<td colspan ="2">SPHERICAL</td>
<td colspan ="2">SPH/CYL</td>
<td colspan ="2">SPH/CYL</td>
<td rowspan="2">Stock</td>
<td rowspan="2">Disclaimer</td>
<td rowspan="2">Index</td>
<td rowspan="2">UV Coating</td>
<td rowspan="2">FOOBAR</td>
<td rowspan="2">FOOBAR</td>
<td rowspan="2">FOOBAR</td>
<td rowspan="2">FOOBAR</td>
<td rowspan="2">FOOBAR</td>
<td rowspan="2">FOOBAR</td>
<td rowspan="2">FOOBAR</td>
</tr>
<tr>
<td>LEFT1</td>
<td>LEFT2</td>
<td>LEFT3</td>
<td>LEFT4</td>
<td>LEFT4</td>
<td>LEFT5</td>
</tr>
<tr>
<td>DATA_LEFT_1</td>
<td>DATA_LEFT_2</td>
<td>DATA_LEFT_3</td>
<td>DATA_LEFT_4</td>
<td>DATA_LEFT_5</td>
<td>DATA_LEFT_6</td>
<td>DATA_RIGHT_1</td>
<td>DATA_RIGHT_2</td>
<td>DATA_RIGHT_3</td>
<td>DATA_RIGHT_4</td>
<td>DATA_RIGHT_5</td>
<td>DATA_RIGHT_6</td>
<td>DATA_RIGHT_7</td>
<td>DATA_RIGHT_8</td>
<td>DATA_RIGHT_9</td>
<td>DATA_RIGHT_10</td>
<td>DATA_RIGHT_11</td>
</tr>
</table>
EDIT 2: Some visual of this: jsFiddle
EDIT 3: Some new visuals with the other answer incorporated: jsFiddle.
Rotating an item in non legacy-IE calculates it's properties before rotating the element. This means the whole item and background will be shifted outside the document flow, probably not what you want in a table. Try rotating the cell content, not the cell itself, like so:
.text-rotation > * {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
height:inherit;
}
... and adding a generic display:block wrapper around the cell content ...
<td rowspan="3" align="center" bgcolor="#66CC00" class="text-rotation"><div>MINUS</div></td>
<td rowspan="3" align="center" bgcolor="#66CC00" class="text-rotation"><div>PLUS</div></td>
<td rowspan="3" align="center" bgcolor="#FFCC00" class="text-rotation"><div>MINUS</div></td>
<td rowspan="3" align="center" bgcolor="#FFCC00" class="text-rotation"><div>PLUS</div></td>
<td rowspan="3" align="center" bgcolor="#0066CC" class="text-rotation"><div>PLUS</div></td>
<td rowspan="3" align="center" bgcolor="#0066CC" class="text-rotation"><div>MINUS</div></td>