Aligning Two Tables in HTML - html

I am attempting to align two separate tables in html. I want them centered with one on the left, one on the right and some space between the tables. Here is the code I currently have set up. I have them aligned, but one is left and one is right with lots of space between them. New to Html please would be appreciated!
<h1>
Retrofit</h1>
<p>
Kendell Retrofit is the latest division to the Kendell divisions. Our Retrofit team includes customer service, outside sales, production and keying specialists. </p>
<div>
<table style="float:left">
</table>
<table align="left" border="0" cellpadding="0" cellspacing="2" style="width: 150px;">
<thead>
<tr>
<th scope="col" style="text-align: left;">
Markets:<br />
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li>
Commercial</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Financial</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Global</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Government</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Healthcare</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Higher Education</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
K-12 Education</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Retail</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<table style="float:right">
</table>
<table align="right" border="0" cellpadding="0" cellspacing="2" style="width: 150px;">
<thead>
<tr>
<th scope="col" style="text-align: left;">
<p>
Brands:</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li>
Arrow</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Best</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Corbin Russwin</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Dorma</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Falcon</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Kwikset</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Sargent</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Schlage</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Stanley</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Weiser</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Yale</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<hr />
<p>
</p>

Basic nested table will do it.
<table width="600px" >
<tr>
<td style="width: 50%;" >
<table width="100%" >
<tr>
<td>
content of left side
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="width: 50%;" >
<table width="100%" >
<tr>
<td>
content of right side
</td>
</tr>
</table>
</td>
</tr>
</table>
Check it here
Note: margin: 0 auto; makes your table at the center

Instead of using float left/right use inline-table as shown below:
table
{
display:inline-table;
}
This way you can have tables side by side.

If you change the value of "style="width: 150px" by one more high (200px or 250px), does it work ?

You only need to float the first table. Then you simply add margin-right: 50px; (for example) to it and the second one will be next to it, 50px away. If you want to center them both, put them in a div with some width and add margin: 0 auto;. Here is a jsbin example.
P.S.: Press edit in top-right corner to see the code. The good thing about using this float to the first table, with 2 seperate tables and with margin: 0 auto; to the parent div is that it is responsive. Try resizing the browser window and you will see how the tables seperate on smaller resolutions (good for a website that is designed to run on smartphones too)

They are misaligned because you have Markets:<br /> in first table and <p>Brands:</p> in second table. You need to be consistent with them.
You can use float:left; and margin-right on the first div to get the spacing.
JSBin sample (Seems like Fiddle is down)

See this DEMO
You can try on the second table :
<table style="float:left">
and replace on the second table :
align="right"
with
align="left"

Related

How to use list item in table cells using html.?

How to use the ordered list in a table, in which each cell will define a list item. like
.
There's no way to define the column first. So I tried to make something like . (This is not what I need. I just tried something because I had no clue to do something like the first picture.)
With this Html code:
<table cellspacing="0" border="1">
<ol type="1">
<tr>
<th>Heading 1</th>
<td>
<li> data</li>
</td>
<td>
<li> data</li>
</td>
<td>
<li> data </li>
</td>
</tr>
</ol>
<ul type="square">
<tr>
<th>Heading 2</th>
<td>
<li> data</li>
</td>
<td>
<li> data</li>
</td>
<td>
<li> data </li>
</td>
</tr>
</ul>
<ol type="A">
<tr>
<th>Heading 3</th>
<td>
<li> data</li>
</td>
<td>
<li> data </li>
</td>
<td>
<li> data </li>
</td>
</tr>
</ol>
</table>
Now I'm confused, how can I use <li> of an ordered or unordered list in each cell to make it as a list view?

Since a few days im not able to select or click html tags on my SVG (Google Chrome)

Since a few days my clickable tags inside my SVG stopped working in google chrome. It's weird and i have tried "everything" and it's STILL not working. This only happens in "Google Chrome" (i'm using Versions 67 and 68 beta)!
Halfway through my SVG I can't click or select anything anymore. it does not have to do with the nav list (the same happens with div tags).
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="4984" height="3534" viewBox="0 0 4984 3534">
<svg id="side_1" x="0" y="0" width="2000" height="3534" version="1.1">
<foreignobject x="118" y="348" width="1406" height="2895">
<body xmlns="http://www.w3.org/1999/xhtml">
<nav class="section__list">
<ul>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>test</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>test</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>test</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>test</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>test</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>test</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>test</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>test</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>test</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>test ?</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
Can't click this
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>Can't select this</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>Can't select this</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>Can't select this</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>Can't select this</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>Can't select this</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>Can't select this</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>Can't select this</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>Can't select this</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>Can't select this</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>Can't select this</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>Can't select this</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>Can't select this</h2>
</td>
</tr>
</table>
</li>
<li class="section__block" style="margin-bottom: 30px;">
<table>
<tr>
<td>
<h2>Can't select this</h2>
</td>
</tr>
</table>
</li>
</ul>
</nav>
</body>
</foreignobject>
</svg>
</svg>
Thanks in advance!
This has been fixed in Chrome 69 See http://crbug.com/859461.

Align two tables withone one misplacing another

I've tried to look at a few web pages but none of them seem to be addressing the specific issue I'm having. I'm trying to make a web page and I'm trying to make a table aligned to the left side of the web page with while the rest in center aligned. However the items ligned in the center are pushed over to the right where the left aligned table is. How can I align something in the center without it being interefered with something aligned on the left side of the page?
Here is my code.
`<!doctype html>
<title> Webpage.</title>
<body>
<body background="Data/Back.jpg">
<table style="float: left" bgcolor="#9999FF" border="solid">
<tr>
<th><ul><h1>Directory.</h1></ul></th></tr>
<br>
<tr><td><li><a href="subpages/skills.html">Skills.</li></td></tr>
<tr><td><li><a href="subpages/experience.html">Experience.</li></td>
</tr>
<tr><td><li><a href="subpages/References">References.</li></td></tr>
<tr><td><li><a href="subpages/ContactInfo.html">Contact Info.</li>
</td></tr>
<tr><td><li><a href="subpages/Resume.html">Resume.</li></td></tr>
</table>
<center>
<table bgcolor="CCCCCC" border="3px solid black">
<tr>
<th><h1><b><u>Name/Header.</u></b></h1></th>
</tr>
</table>
<img src="Data/Me.jpg" width="25%">
<table bgcolor="#819FF7" width="50%" border="solid">
<tr>
<th>About me.</th>
</tr>
<tr>
<td>Subject
</td>
</tr>
</center>
<style type="text/css">
h1{
color: #0404B4
}
th{
color: #61380B
}
td{
color: #8A0829
}
</style>
</body>`
Simply remove float: left from the first table. Floating an element means that other elements will attempt to occupy any remaining width when that element is less than 100% of the width of the parent. Alternatively, clear the floats afterwards with clear: both.
Here's an example, cleanly formatted, and removing float: left.
h1 {
color: #0404B4;
}
th {
color: #61380B;
}
td {
color: #8A0829;
}
<body>
<table bgcolor="#9999FF" border="solid">
<tr>
<th>
<div style="margin-left: 2em">
<h1>Directory.</h1>
</div>
</th>
</tr>
<tr>
<td>
<ul>
<li>
Skills.
</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Experience.
</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
References.
</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Contact Info.
</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>
Resume.
</li>
</ul>
</td>
</tr>
</table>
<center>
<table bgcolor="#CCCCCC" border="3px solid black">
<tr>
<th>
<h1><b><u>Name/Header.</u></b></h1>
</th>
</tr>
</table><img src="Data/Me.jpg" width="25%">
<table bgcolor="#819FF7" border="solid" width="50%">
<tr>
<th>About me.</th>
</tr>
<tr>
<td>Subject</td>
</tr>
</table>
</center>
</body>
Hope this helps! :)

HTML Table Build Two Menus in one TD

I have a table with one row and 2 columns. I have two menus that I would like to put in 1 column. One to the top and the second to the bottom. The valign doesn't work, I cant figure out how to make it work, the text in the second td can change so if it grows the second menu should be pushed to the bottom,
Please see my current code below:
<table>
<tr>
<td>
<table>
<tr>
<td valign="top">
<div class="left">
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
</div>
</td>
</tr>
<tr>
<td valign="bottom">
<div class="left">
<ul>
<li>four</li>
<li>five</li>
</ul>
</div>
</td>
</tr>
</table>
</td>
<td valign="bottom">
<div>
some text here
</div>
</td>
</tr>
There is nothing wrong with your code
try to add border="1" on all table tag. <table border ="1"> you'' figure it out
try to valign your last <div>
or colspan on your specified <td>
new updated with this code will makes:
<table border="1">
<tr>
<td>
<table border ="1">
<tr>
<td valign="top">
<div class="left">
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
</div>
</td>
</tr>
<tr>
<td valign="bottom">
<div class="left">
<ul>
<li>four</li>
<li>five</li>
</ul>
</div>
</td>
</tr>
</table>
</td>
<td valign="bottom" style="display:block; margin-left:auto; margin-right: auto;">
<div>
some text here some text here some text here some text here some text here some text here some text here some text here
</div>
</td>
</tr>

How to substitute a table by li tags?

I just want to order some li tags the same way I would do with this code
<table>
<tr>
<td colspan='2' rowspan='2'>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
For JQuery script reason, I can't use a table, only a list, but I want to display it just like it would have been with a table.
So, I don't know which of theses properties I have to use:
Inline-block,
Block,
Inline
As the comments mention: display: table-cell is the key. The layout you asked for should look something like
<ul style="display: table;">
<li style="display: table-row;">
<ul>
<li style="display: table-cell;"></li>
...
</ul>
</li>
...
</ul>