How to create a html irregular table? - html

enter image description here
I want to create an HTML irregular table like this.
enter image description here
but I don't know what's wrong with my code
<html>
<head>
<title>Test 2</title>
</head>
<body>
<table border="1" width="500px" height="100px">
<tr>
<td>Zoology</td>
<td rowspan="3">Welcome</td>
<td>Maths</td>
</tr>
<tr>
<td>Batany</td>
<td rowspan="3">Physics</td>
</tr>
<tr>
<td rowspan="2">Entomology</td>
</tr>
<tr>
<td rowspan="2">Heading</td>
</tr>
<tr>
<td>Toxicology</td>
<td>Computer</td>
</tr>
</table>
</body>
</html>
Please help!

<html>
<head>
<title>Test 2</title>
<style>
table, tr, td
{
border-collapse: collapse;
border: 2px solid black;
padding: 5px;
}
tr
{
height: 30px;
}
</style>
</head>
<body>
<table border="1" width="500px" height="100px">
<tr>
<td>Zoology</td>
<td rowspan="3">Welcome</td>
<td>Maths</td>
</tr>
<tr>
<td>Batany</td>
<td rowspan="3">Physics</td>
</tr>
<tr>
<td rowspan="2">Entomology</td>
</tr>
<tr>
<td rowspan="2">Heading</td>
</tr>
<tr>
<td>Toxicology</td>
<td>Computer</td>
</tr>
</table>
</body>
</html>

Related

How to position a table in right side of screen using HTML?

How to position a table on the right side of the screen? The desired output looks like this:
table on the right
How do we pull it off? Thanks!
The code I used is:
<!DOCTYPE html>
<html>
<head>
<style>
table,
th,
td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr>
<td colspan="2">Sum: $180</td>
</tr>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
</body>
</html>
sometimes reading documentation may be useful
table,
th,
td {
border: 1px solid black;
}
table {
float: right;
}
<table>
<tr>
<td colspan="2">Sum: $180</td>
</tr>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
You can make the table right side by using following code:
table{
width: auto;
float: right;
}
table {
width: auto;
float: right;
}
<html>
<body>
<table>
<tr>
<td>
Item 1
</td>
<td>
Item 2
</td>
</tr>
</table>
</body>
</html>
The needed code to pull it off is:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
table, th, td {
border: 1px solid black;
}
table {float: right;}
</style>
</head>
<body>
<table>
<tr>
<th colspan="2">Ouch</th>
</tr>
<tr>
<th colspan="2"><img src=AAAAAHjpg" alt="Posporo" width="300" height="300"></th>
</tr>
<tr>
<th colspan="2">Professional</th>
</tr>
<tr>
<th>Affiliation</th>
<td>Mafia</td>
</tr>
<tr>
<th>Profession</th>
<td>Eater</td>
</tr>
<tr>
<th>Partner</th>
<td>You</td>
</tr>
<tr>
<th>Base</th>
<td>Somewhere</td>
</tr>
<tr>
<th colspan="2">Personal</th>
</tr>
<tr>
<th>Education</th>
<td>Pamantasan ng Unibersidad ng Paaralan</td>
</tr>
<tr>
<th colspan="2">Signature</th>
</tr>
<tr>
<th colspan="2">gd jasdagjadgjd</th>
</tr>
</table>
</body>
</html>

HTML/CSS formatting for Outlook template - table/row/cell height not working

I'm having trouble with getting the height of the leftmost (commented) nested table to automatically size in correspondence with the content on the right. It looks fine in Chrome, but in Word/Outlook it's not stretching.
Does anyone know how to get this working in Word/Outlook?
how it should look
how it actually looks
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style>
th, td {
padding: 0;
}
table.border {
border-collapse: collapse;
border-spacing: 0;
}
.borderOutline {
border: 4px solid #000000;
}
</style>
</head>
<body>
<table class="border" align="center" width="588" height="100%">
<tbody>
<tr valign="top">
<td width="12">
<!--PROBLEM TABLE START-->
<table class="border" width="100%" height="100%">
<tbody>
<tr bgcolor="red"><td> </td></tr>
<tr bgcolor="orange"><td> </td></tr>
<tr bgcolor="yellow"><td> </td></tr>
<tr bgcolor="green"><td> </td></tr>
<tr bgcolor="blue"><td> </td></tr>
<tr bgcolor="purple"><td> </td></tr>
</tbody>
</table>
<!--PROBLEM TABLE END-->
</td>
<td width="576">
<table class="border" width="100%" height="100%">
<tbody>
<tr height="75">
<td class="borderOutline">
<table cellspacing="20" cellpadding="20">
<tbody>
<tr>
<td>HEADER</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="borderOutline">
<table cellspacing="20" cellpadding="20">
<tbody>
<tr>
<td>
<p>BODY</p>
<p>will</p>
<p>contain</p>
<p>variable</p>
<p>amount</p>
<p>of</p>
<p>text</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr height="75">
<td class="borderOutline">
<table cellspacing="20" cellpadding="20">
<tbody>
<tr>
<td>FOOTER</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>
The problem you have is acutally quite common and annoyed a lot of people in the past.
As far as I know, Word and Outlook are using the Internet Explorer Engine, so you will find the unconvinient answer in this thread:
IE display: table-cell child ignores height: 100%
(SPOILER: It's probably not possible)

HTML: how to use colspan and rowspan?

I am trying to build a very simple array, but somehow It is not working How I think it should. Here is an example:
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table width=100%>
<tr>
<th colspan="8">sigle row of 8 cols</th>
</tr>
<tr >
<td colspan="2">2 cols </td>
<td rowspan="3" colspan="6" > 6 cols</td>
</tr>
<tr>
<td colspan="2">2 cols</td>
</tr>
<tr>
<td colspan="2">2 cols</td>
</tr>
</table>
</body>
</html>
Please help me to debug.
I want the months to occupy only 2 column and the saving to occupy 6 columns (the rest), but, this is not working as expected. I know the answer is trivial, but I cannot find it. Can you please tell me what is wrong?
The table will have 8 columns, but you have effectively reduced it to 2. The table rendering algorithm will make things as efficient as it can.
By adding an additional row you can see what is happening
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table width=100%>
<tr>
<th colspan="8">Monthly Savings</th>
</tr>
<tr >
<td colspan="2">January</td>
<td rowspan="3" colspan="6" >$30000</td>
</tr>
<tr>
<td colspan="2">February</td>
</tr>
<tr>
<td colspan="2">March</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
</tr>
</table>
</body>
</html>
What you are better off doing is assigning width to the columns
table, th, td {
border: 1px solid black;
}
<table width=100%>
<tr>
<th colspan="2">Monthly Savings</th>
</tr>
<tr >
<td style="width:33%">January</td>
<td rowspan="3" style="width:66%" >$30000</td>
</tr>
<tr>
<td>February</td>
</tr>
<tr>
<td>March</td>
</tr>
</table>
because the you add heading in single <th> so make id different
<th colspan="2">Monthly</th>
<th colspan="6">Savings</th>
so it will display 2 for month and 6 for saving
<!DOCTYPE html>
<html>
<head>
<style>
table,
th,
td {
border: 1px solid black;
}
</style>
</head>
<body>
<table width=100%>
<tr>
<th colspan="2">Monthly</th>
<th colspan="6">Savings</th>
</tr>
<tr>
<td colspan="2">January</td>
<td rowspan="3" colspan="6">$30000</td>
</tr>
<tr>
<td colspan="2">February</td>
</tr>
<tr>
<td colspan="2">March</td>
</tr>
</table>
</body>
</html>

How to highlight independent table cells with same values

I have two independent tables. How to manage when I mouse over one of the cell on Table 1 then cells which have the same values on Table 2 turn highlighted? I prefer to use html/css coding, not JQuery?
I worked on code below but no success.
<HTML>
<STYLE type=text/css>
tr:hover td.highlight776{ background-color:red; }
tr:hover td.highlight970{ background-color:blue; }
tr:hover td.highlight1024{ background-color:magenta; }
tr:hover td.highlight1197{ background-color:yellow; }
tr:hover td.highlight1200{ background-color:orange; }
tr:hover td.highlight1015{ background-color:orange; }
</STYLE>
<HEAD>
<TITLE></TITLE>
<META name="description" content="">
<META name="keywords" content="">
<META name="generator" content="CuteHTML">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
<br><br>
Table 1
<Table border=1>
<tr>
<td class="highlight776">Proje 776</td>
</tr>
<tr>
<td class="highlight1015">Proje 1015</td>
</tr>
<tr>
<td class="highlight970">Proje 970</td>
</tr>
<tr>
<td class="highlight1024">Proje 1024</td>
</tr>
<tr>
<td class="highlight1197">Proje 1197</td>
<tr>
<td class="highlight1200">Proje 1200</td>
</tr>
</Table>
<br><br><br>
Table 2
<Table class="tahsis" border=1>
<tr>
<td class="highlight776">776</td>
<td class="highlight1015">1015</td>
<td class="highlight776">776</td>
<td class="highlight970">970</td>
<td class="highlight1024">1024</td>
<td class="highlight970">970</td>
</tr>
<tr>
<td>970</td>
<td>776</td>
<td>776</td>
<td>776</td>
<td>1015</td>
<td>1015</td>
<tr>
<td>1015</td>
<td>776</td>
<td>970</td>
<td>970</td>
<td>1024</td>
<td>970</td>
</tr>
</Table>
</BODY>
</HTML>

HTML Table with 2 (two) rows set beside a 4 (four) row set

How would I achieve this table layout?
Here's a sample:
<!doctype html>
<html>
<head>
<title>Rows Demo </title>
<style>
table {
border: 1px solid black;
}
td {
border:1px solid blue;
}
</style>
</head>
<body>
<table>
<tr>
<td rowspan=2>Something</td>
<td rowspan=2>Something more</td>
<td>LastColumn</td>
</tr>
<tr>
<td>Column3</td>
</tr>
<tr>
<td rowspan=2>Something</td>
<td rowspan=2>Something more</td>
<td>LastColumn</td>
</tr>
<tr>
<td>Column3</td>
</tr>
</table>
</body>
</html>