How to fix table width breaking out from div? - html

Table works normally in 100%, but when I zoom in the table width is not following the screen size. I want to use overflow-scroll to make this work but the scroll bar is not showing.
I don't want to use table-layout fixed with width 100%.
Image below shows the table out of div that makes my upper div (title) going out of div too
HTML
<div id="content">
<div class="breadCrumbs">
<h2 id="breadhead">Report Management</h2>
<div class="clearfix"></div>
</div>
<div class="frameBody p-4 p-md-5 pt-5">
<div class="row">
<div class="col-md-12 tableCover" style="overflow:scroll" >
<table id="tblBranchs" class="table table-bordered " >
<thead>
<tr>
<td >Kode Branch</td>
<td width="5%">Grup</td>
<td >Nama</td>
<td width="20%">Alamat</td>
<td >Bank</td>
<td >Nama Bank</td>
<td >No. Rekening</td>
<td >Kota</td>
<td >Tindakan</td>
</tr>
</thead>
<tbody>
<tr>
<td>12345</td>
<td>12345</td>
<td>12345</td>
<td>123453iuuihefsbefjhsbfjsbfjbsf</td>
<td>12345</td>
<td>12345kl3jhsekfnkljsebf</td>
<td>12345</td>
<td>12345</td>
<td>12345</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
CSS
#content{
width: 100%;
padding: 0;
min-height: 100vh;
transition: all 0.3s;
margin-left: 200px;
}
#breadCrumbs{
padding-top: 4rem;
padding-bottom: 2rem;
padding-left: 3rem;
border-radius: 0px 0px 13px 13px;
box-shadow: 0px 4px #d4d4d6;
}
.table{
width:100%;
}
How to correct this table problem. If i'm using table layout fixed. It shows all table column without scroll but it looks bad
**EDIT
Seems like it's because tableCover width is set 100%. If i set width to (e.g 700px) this is works. But how can make tableCover width following width of the content class width (white screen width) ?
**EDIT 2
The scroll is shown, but why is the table out of div?
This works well if i hide the sidebar, but why it's not responsive when sidebar is active?

Try This
#content
{
width: 100%;
padding: 0;
min-height: 100vh;
transition: all 0.3s;
}
#breadCrumbs
{
padding-top: 4rem;
padding-bottom: 2rem;
padding-left: 3rem;
border-radius: 0px 0px 13px 13px;
box-shadow: 0px 4px #d4d4d6;
}
.table
{
width:100%;
}

Change your CSS code like this:
*,
*:before,
*:after {
box-sizing: border-box;
}
#content{
width: 100%;
padding: 0;
min-height: 100vh;
transition: all 0.3s;
margin-left: 200px;
}
#breadCrumbs{
padding-top: 4rem;
padding-bottom: 2rem;
padding-left: 3rem;
border-radius: 0px 0px 13px 13px;
box-shadow: 0px 4px #d4d4d6;
}
.table {
display: block;
width: 100%;
}

Related

Im currently trying to make a simple game using html and css only (might have some java but barely any) and I can't seem to put 5tables side by side

This is what I'm trying to make
There are a couple reasons on why I'm having trouble making this, I can't put all of these tables in one big table since that will make the main box able to go through all the obstacles.
Here's the code for a simple level to show what I'm trying to do exactly:
Html:
<!DOCTYPE HTML>
<html lang="en-us">
<head>
<title> Level 1 </title>
<link rel="stylesheet" type="text/css" href="Mohanned_Project.css" />
<style>
body {
background: blue;
background-size: cover;
}
</style>
</head>
<body>
<table>
<tr>
<th>
<img src="Obstacle_1.png" height="285px" width="1400px">
<img src="Box.png" id="Goat" align="left">
<img src="Win.png" align="right">
</th>
</tr>
</table>
<table style="padding: 0px 1300px 1300px 0px;">
<tr>
<th>
<img src="Obstacle_1.png" height="285px" width="1400px">
</th>
</tr>
</table>
</body>
</html>
Css:
#Goat {
position: sticky;
top: 300px;
left: 10px;
right: 10px;
}
#Goat_2 {
position: sticky;
top: 10px;
left: 10px;
right: 10px;
}
.btn{
color: #fff;
border: none;
margin: 5px;
padding: 10px 8px;
font-size: 20px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 2px;
cursor: pointer;
border-radius: 10px;
transition: 0.4s;
transition-property: box-shadow;
}
.btn-primary{
font-size: 31px;
}
and heres the result: When you move the screen, the red box sticks to the borders and moves
I would really apprecciate advice on how do I set up the 2nd level since I've been trying for an hour and can't seem to figure it out
Stop using tables. Use divs. and flexbox.
.cafeteria {
display: flex;
flex-direction: column;
}
.first-row {}
.table-row {
display: flex;
}
.table {
width: 40px;
height: 200px;
border: 1px solid black;
background-color: brown;
}
.small-table {
align-self: flex-end;
width: 40px;
height: 100px;
background-color: brown;
}
.small-table.blue {
background-color: blue;
}
.small-table.green {
background-color: green;
}
<div class="cafeteria">
<div class="first-row">
<div class="small-table blue"></div>
</div>
<div class="table-row">
<div class="table"></div>
<div class="small-table"></div>
<div class="table"></div>
<div class="small-table"></div>
<div class="table"></div>
<div class="small-table"></div>
<div class="table"></div>
<div class="small-table green"></div>
<div class="table">
</div>
</div>
</div>

HTML "Div" cannot show full height on small monitors

I have 2 monitors. The one is 24" and the other is my laptop's monitor (12.5"). A "div" (red box) in my web application can be shown on big monitor full height, but just part of it on my small monitor.
My question is why it displays differently on different size of monitor? Because all height settings in my css are percentage and I never used absolute number for the height. Why does the red box (div id is "scrollTable") show differently on different size of monitor? Because this issue, the dynamic table in this "div" cannot be shown completely even if the div is scrolled to the bottom. The row number of the dynamic table depends on Users' search result, maybe only 1 or 2 rows or maybe more than 30 or 40 rows sometimes. Please see the css and html below. Thanks for your help.
html,
body {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
overflow: hidden;
}
header {
height: 6%;
margin: 0px;
padding: 0.2px;
padding-left: 6px;
text-align: left;
vertical-align: central;
background: #8a1841;
color: papayawhip;
display: block;
}
#nsmap {
float: left;
left: 0;
width: 80%;
bottom: 0;
height: 94%;
}
#searchPanel {
padding: 3px;
float: right;
height: 94%;
width: 20%
}
#HomeButton {
position: absolute;
top: 135px;
left: 20px;
z-index: 50;
}
label {
font-size: 10px;
font-weight: bold;
text-align: center;
}
table.imagetable {}
table.imagetable tr td {
border: 1px solid #000000;
text-align: center;
padding: 8px;
font-size: 10px;
}
table.imagetable th {
border: 1px solid #000000;
text-align: center;
padding: 8px;
font-size: 10px;
}
table.imagetable tr:nth-child(even) {
background-color: #92c8da;
}
table.imagetable tbody tr:hover {
background-color: #EBECCD;
}
.cboWidth {
border: 1px solid #000000;
width: 100%;
}
.ccTable1 {
height: 77%;
}
#scrollTable {
border: 2px solid red;
max-height: 80%;
min-height: 80%;
width: 100%;
overflow-y: auto;
overflow-x: auto;
}
#StreetKey {
width: 100%;
}
.thirty {
width: 30%;
}
.twenty {
width: 20%;
}
.fifteen {
width: 15%;
}
thead {
visibility: visible;
}
.dijitButtonNode {
width: 160px;
height: 25px;
text-align: left;
font-size: 16px;
border: hidden;
}
.dijitButtonNode:hover {
font-weight: bold;
}
.center {
display: block;
margin-left: 52%;
width: 45%;
}
#tbPrint {
border: 0px;
padding: 8px;
min-width: 350px;
max-width: 350px;
}
.tdPrint {
border: 0px;
text-align: left;
padding: 0px;
font-size: 10px;
max-width: 140px;
min-width: 140px;
}
#trPrint {
background-color: white;
}
<!DOCTYPE html>
<html>
<head></head>
<body>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<title> Online Map Book </title>
<header>
<h4>Online Map Guide Book</h4>
</header>
<div id="nsmap" style="background-color:whitesmoke">
</div>
<div id="searchPanel">
<form action="/action_page.php">
<label style="font-weight:bold;font-size:12.5px">Select Electoral District:</label> <br>
<select id="EDNum" name="EDNum" class="cboWidth"></select>
<br><br>
<label style="font-weight:bold;font-size:12.5px">
Select Polling Division: </label><br>
<select id="PDNum" name="PDNum" style="border:1px solid #000000"></select>
<br><br>
<div class="dropdown" style="width:100px">
<table id="tbPrint">
<tr>
<td><label style="font-size:12.5px">Print map or street key:</label></td>
</tr>
<tr id="trPrint">
<td class="tdPrint">
<button id="btnPrintGroup" class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" disabled>
Print
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<div id="btnPrint"></div>
</li>
<li>
<div>
<div class="dijitButtonNode" id="btnStKey" onclick="printStKey()" style="margin-left:10px">
Street Key
</div>
</div>
</li>
</ul>
</td>
</tr>
</table>
</div>
</form>
<hr>
<div id="StreetKey" class="ccTable1">
<div style="font-size:14px; font-weight:bold"> Street Key </div>
<div id="scrollTable">
<table id="streetTable" class="imagetable " style="cursor: pointer;">
<colgroup>
<col class="thirty" />
<col class="twenty" />
<col class="fifteen" />
<col class="fifteen" />
<col class="twenty" />
</colgroup>
<thead>
<tr>
<th>Street</th>
<th>Town</th>
<th>Low No.</th>
<th>High No.</th>
<th>Order</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</body>
</html>
When you use 100% it means that you take the whole heigth os the div's parent. If you want to show your div always in the viewport, try using this units : vh
They mean: viewport height, so if you set the height:100vh, the div will always be fit to the viewport no matter what screen. :)
https://css-tricks.com/fun-viewport-units/

Nested div doesn't overlap parent's siblings

I have a very convoluted table in which I have to add a menu that appears on hover and has its position based on each row's position.
Every row is generated at the same time in a loop (React props.map), so changing the next row z-index is possible, but I don't know if I should.
I managed to do some work, but I can't seem to make the menu appear on top of the "th" other than its parent.
I know it (probably) has to do with the Stacking Context, but I don't know how to fix this.
This fiddle represents a very resumed version of the table: https://jsfiddle.net/4n9bj16x/2/
I tried a lot of things, and some worked but then it broke something else. What I need is a way of maintaining the first column fixed and make this menu overlap all "th" siblings.
Things that worked but broke something else:
Taking the "sticky" position out of the "th", the menu will overlap perfectly, but then it break the fixed first column.
Make the menu relative positioned, then it enters the normal flow, but that makes the div grow in and out.
Remove the "th" background-color property, but then it becomes invisible and, when the table is scrolled, you can see all the other columns underneath.
Thanks in advance!
PS: The original table is coded in React and SCSS, if this is of any help.
HTML & CSS: (the fiddle is written in scss because its easier to read)
.overflowTable {
overflow-x: scroll;
margin-left: 0;
overflow-y: visible;
padding: 0;
position: relative;
height: 100vh;
}
table {
border-collapse: separate;
}
tr {
background-color: white;
}
th {
border-right: 2px solid #eee;
font-weight: 600;
color: #333;
left: 0;
position: sticky;
z-index: 2;
background-color: inherit;
}
tbody tr:hover {
background-color: #fafafa;
}
tbody th {
cursor: pointer;
}
tbody td {
cursor: grab;
}
tbody td:active {
cursor: grabbing;
}
.headerTable {
font-family: "Open-sans", sans-serif;
font-style: normal;
font-weight: 600;
font-size: 18px;
line-height: 25px;
color: #666;
border-bottom: 2px solid #eee;
padding: 10px 30px;
min-width: 150px;
}
.content {
padding: 10px 30px;
}
.content .actualMenu {
visibility: hidden;
}
.content .menuMore {
position: absolute;
width: 250px;
visibility: hidden;
right: 0;
background-color: #333;
color: white;
box-shadow: 0 4px 2px rgba(0, 0, 0, 0.1), 4px 4px 10px rgba(0, 0, 0, 0.1);
}
.content:hover .actualMenu, .content:hover .menuMore {
visibility: visible;
}
.content .title {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.content .title .name {
flex: 1;
}
.content .title .moreOptions {
position: relative;
flex: 0;
}
<div class="overflowTable">
<table>
<thead>
<tr>
<th class="headerTable">
Name
</th>
<td class="headerTable">
Status
</td>
<td class="headerTable">
People
</td>
<td class="headerTable">
Date
</td>
</tr>
</thead>
<tbody>
<tr>
<th class="content">
<div class="title">
<div class="name">
Name
</div>
<div class="moreOptions">
<span class="actualMenu">...</span>
<div class="menuMore"> Options<br/>
Options<br/>
Options<br/>
Options<br/>
Options<br/>
</div>
</div>
</div>
</th>
<td class="content">
Status
</td>
<td class="content">
First Person
</td>
<td class="content">
Random Date
</td>
</tr><tr>
<th class="content">
<div class="title">
<div class="name">
Name
</div>
<div class="moreOptions">
<span class="actualMenu">...</span>
<div class="menuMore"> Options<br/>
Options<br/>
Options<br/>
Options<br/>
</div>
</div>
</div>
</th>
<td class="content">
Status
</td>
<td class="content">
First Person
</td>
<td class="content">
Random Date
</td>
</tr>
</tbody>
</table>
</div>
FIRST ANSWER:
You have to remove background-color: inherit; from th.
w3schools resource:
The inherit keyword specifies that a property should inherit its value from its parent element.
UPDATE:
First of all, sorry for misunderstanding,
You gave z-index: 2; to .content class. Its mean all .content elements have equal index. You can fix this and add another way. Go second row and add z-index: 3; then you will understand me. :)
here is fiddle
<th class="content" style="z-index: 3!important;">
Sorry for my bad english.
On hover change tr's and th's z-index
.overflowTable {
overflow-x: scroll;
margin-left: 0;
overflow-y: visible;
padding: 0;
position: relative;
height: 100vh;
}
table {
border-collapse: separate;
}
tr {
background-color: white;
position: relative;
z-index: 1;
}
tr:hover {
z-index: 2;
}
tr:hover th {
z-index: 3;
}
th {
border-right: 2px solid #eee;
font-weight: 600;
color: #333;
left: 0;
position: sticky;
z-index: 2;
background-color: inherit;
}
tbody tr:hover {
background-color: #fafafa;
}
tbody th {
cursor: pointer;
}
tbody td {
cursor: grab;
}
tbody td:active {
cursor: grabbing;
}
.headerTable {
font-family: "Open-sans", sans-serif;
font-style: normal;
font-weight: 600;
font-size: 18px;
line-height: 25px;
color: #666;
border-bottom: 2px solid #eee;
padding: 10px 30px;
min-width: 150px;
}
.content {
padding: 10px 30px;
}
.content .actualMenu {
visibility: hidden;
}
.content .menuMore {
position: absolute;
width: 250px;
visibility: hidden;
right: 0;
background-color: #333;
color: white;
box-shadow: 0 4px 2px rgba(0, 0, 0, 0.1), 4px 4px 10px rgba(0, 0, 0, 0.1);
}
.content:hover .actualMenu, .content:hover .menuMore {
visibility: visible;
}
.content .title {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.content .title .name {
flex: 1;
}
.content .title .moreOptions {
position: relative;
flex: 0;
}
<div class="overflowTable">
<table>
<thead>
<tr>
<th class="headerTable">
Name
</th>
<td class="headerTable">
Status
</td>
<td class="headerTable">
People
</td>
<td class="headerTable">
Date
</td>
</tr>
</thead>
<tbody>
<tr>
<th class="content">
<div class="title">
<div class="name">
Name
</div>
<div class="moreOptions">
<span class="actualMenu">...</span>
<div class="menuMore"> Options<br/>
Options<br/>
Options<br/>
Options<br/>
Options<br/>
</div>
</div>
</div>
</th>
<td class="content">
Status
</td>
<td class="content">
First Person
</td>
<td class="content">
Random Date
</td>
</tr><tr>
<th class="content">
<div class="title">
<div class="name">
Name
</div>
<div class="moreOptions">
<span class="actualMenu">...</span>
<div class="menuMore"> Options<br/>
Options<br/>
Options<br/>
Options<br/>
</div>
</div>
</div>
</th>
<td class="content">
Status
</td>
<td class="content">
First Person
</td>
<td class="content">
Random Date
</td>
</tr>
</tbody>
</table>
</div>

How to resize based on zoom or screensize

My HTML code:
<div id="divMainFirst">
<div id="divInnerFirst">
<div id="divTitleHeaderUC">
<span id="spanTitleHeaderUC">Urgent Care Wait Time</span>
</div>
<div id="divSubTitleUC">
<div id="smallText" style="padding:0 5px; position: absolute; bottom: 1%; left: 0; right: 0; color: #000000; text-align: center;">If you are experiencing a life-threatening emergency, call 911 or go to your nearest emergency room. Do not go to the urgent care center.<br>Estimated wait times are provided for general information only, may change at any time, and may not reflect your actual wait time once you arrive.</div>
</div>
</div>
<div id="divInnerNext">
<div id="divTitleHeaderFD">
<span id="spanTitleHeaderFD">Find a Doctor</span>
</div>
<div id="divSubTitleFD">
<span style="width: 100%; text-align: center;">
<table cellpadding="5">
<tr>
<td class="alignLeft">By Name [View All]:</td>
</tr>
<tr>
<td style="padding-left: 15px;">
<select>
<option>TEST1</option>
<option>TEST2</option>
</select>
</td>
</tr>
<tr>
<td class="alignLeft">By Specialty [View All]:</td>
</tr>
<tr>
<td style="padding-left: 15px;">
<select>
<option>TEST1</option>
<option>TEST2</option>
</select>
</td>
</tr>
<tr>
<td class="alignLeft">By Location [View All]:</td>
</tr>
<tr>
<td style="padding-left: 15px;">
<select>
<option>TEST1</option>
<option>TEST2</option>
</select>
</td>
</tr>
</table>
</span>
</div>
</div>
</div>
My CSS code:
#divMainFirst {
display: block;
margin: 0 0 0 200px;
overflow: hidden;
}
#divInnerFirst {
display: inline-block;
margin: 0 0 0 100px;
height: 270px;
padding: 0;
width: 265px;
vertical-align: top;
}
#divInnerNext {
display: inline-block;
margin: 0 0 0 50px;
height: 270px;
width: 265px;
vertical-align: top;
}
#divTitleHeaderUC {
width: 265px;
height: 40px;
background-color: #FFFFFF;
text-align: center;
box-shadow: inset 0 0 10px rgba(245, 159, 36, 0.5);
position: relative;
}
#spanTitleHeaderUC {
width: 100%;
height: 40px;
line-height: 40px;
vertical-align: middle;
background-color: #FFFFFF;
font-family: 'blackjarregular';
font-size: 18pt;
color: #F59F24;
font-weight: bold;
}
#divSubTitleUC {
width: 265px;
height: 220px;
background-color: #FFFFFF;
text-align: center;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
-webkit-box-shadow: #F59F24 0px 2px 3px;
-moz-box-shadow: #F59F24 0px 2px 3px;
box-shadow: #F59F24 0px 2px 3px;
position: relative;
}
With the above HTML and CSS code, It displays the following zoomed in and by default:
But when I view it in different size screen it changes to this:
As you can see the size of the box hasn't changed and not shrunk to fit all three boxes instead it overflows on to the next section below the first two and cannot be seen.
How can I modify so boxes changes based on the zoom in/screen size?
Have a look into #media queries within your CSS.
With media queries, you can set break points to change the CSS doing things such as hiding certain elements when they're no longer required for the device they're being used on.
Have a look at https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries
That will give you a much more in-depth explanation behind the queries and how to use them effectively.
use percentages for everything. or #media (min-width: 768px) {}

Remove space between 2 tables HTML CSS and image removes background image

New here, I am creating a website and there seems to be a problem with a table I made to hold an image and a table I made to hold content. Content on left image on right. When I float the Image table right the content table moves completely underneath it. When I float it left there is too much space in between the 2. The code in question is table and table 3.
I want it to display the image block next to the link buttons and the context block underneath the buttons but next to the image block.
The second problem is my logo heading which is an image is removing the background image.
HTML Code
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<link href="Articlepage.CSS" rel="stylesheet" type="text/css">
<title>BEADLES BEADING</title>
</head>
<body id="wrap">
<h1><img src="logo.jpg" alt="logo"></h1>
<a class="mouseover" href="Home Page.html"><img src="Buttons/New button Home Unpressed.jpg" alt="home"></a>
<a class="mouseover1" href="Article Page.html"><img src="Buttons/New button About us pressed.jpg" alt="about_us"></a>
<a class="mouseover2" href="Section Page.html"><img src="Buttons/New button Products Unpressed.jpg" alt="products"></a>
<a class="mouseover3" href="Contact us.html"><img src="Buttons/New button Contact us Unpressed.jpg" alt="contact_us"></a>
<a class="mouseover4" href="url"><img src="Buttons/New button Home Unpressed.jpg" alt="home"></a>
<table3>AD SPACE(Image)</table3>
<table>
<tr>
<td>
<b>IMAGE/CONTENT</b>
<b>IMAGE/CONTENT</b>
<b>IMAGE/CONTENT</b><br>
<b>IMAGE/CONTENT</b>
<b>IMAGE/CONTENT</b>
<b>IMAGE/CONTENT</b>
<br><br><br><br><br><br><br><br><br><br><br>
</td>
</tr>
</table>
<table2>
<tr>
<td>
FOOTER
</td>
<tr>
</table2>
</body>
</html>
CSS code
div {
text-align: left;
position: relative;
font-size: 2.5em;
font-weight: bold;
}
div1 {
text-align: left;
position: relative;
font-size: 1.5em;
text-shadow: 2px 2px black;
font-family: Georgia, Times, serif;
text-shadow: -1px -1px black, 1px 1px;
}
h1 {
text-align: left;
font-family: Arial, Helvetica, sans-serif;
text-shadow: 0.1em 0.1em 0.2em black;
font-size: 2em;
font-style: italic;
float: inline;
border: 3px solid black;
width: 800px;
height: 196px;
padding: 0;
}
h2 {
text-align: left;
position: relative;
font-size: 1.5em;
font-family: Verdana, Helvetica, sans-serif;
text-shadow: -1px -1px black, 1px 1px;
}
p {
position: relative;
text-align: left;
font-size: 1em;
font-family: Georgia, Times, serif;
text-shadow: -1px -1px black, 1px 1px;
}
li {
position: relative;
font-size: 1em;
}
a {
padding: 0;
float: left;
}
b {
border: 3px solid black;
width: 180px;
height: 10.5em;
padding: 10px;
float: left;
}
b1 {
border: 3px solid black;
position: absolute;
width: 40px;
height: 23em;
padding: 10px;
float: right;
position: relative;
}
b2 {
border: 3px solid black;
position: absolute;
width: 40px;
height: 23em;
padding: 10px;
position: relative;
}
body {
background-image: url("background.jpg");
background-size: 100%;
margin: 20px;
width: 800px;
padding: 30px;
position: relative;
}
.centeredImage {
text-align: center;
margin-top: 0px;
margin-bottom: 0px;
}
table {
display: inline-block;
width: 640px;
margin-left: auto;
margin-right: auto;
border-style: solid;
border-width: 5px;
text-align: center;
height: 400px;
padding: 0;
}
table2 {
display: inline-block;
width: 625px;
margin-left: auto;
margin-right: auto;
border-style: solid;
border-width: 5px;
text-align: center;
height: 50px;
}
td {
text-shadow: 0.1em 0.1em 0.2em black;
font-family: "Times New Roman", Times, serif;
}
table3 {
float: right;
width: 150px;
border-style: solid;
border-width: 5px;
text-align: right;
height: 490px;
padding: 0;
}
p2 {
border: 10px solid black;
float: rights;
}
select {
width: 200px;
}
#wrap {
width: 900px;
margin: 0 auto;
}
Image link.
Look I am sure you get the just of what it should look like. Plus the white background should have a lilac image I placed into the body as background.
I think the two main problems are:
You are using tags that don't exist and
You aren't considering the width of the borders when setting your sizes
You set the width of the body to 800px, the first table to 640px, and that table3 to 150px. But the borders on both are 5px wide. 640 + 10 (left and right border of the first table) +10 (left and right border of the second table) + 150 = 810. Even if the tags were correct they're too wide to go next to each other.
Change
<table3>Ad Space</table3>
and
<b>IMAGE/CONTENT</b>
<b>IMAGE/CONTENT</b>
<b>IMAGE/CONTENT</b><br>
<b>IMAGE/CONTENT</b>
<b>IMAGE/CONTENT</b>
<b>IMAGE/CONTENT</b>
To
<div id="adCol">Ad Space</div>
and
<div id="#imgDiv">
<img />
<img />
<img /><br />
<img />
<img />
<img />
</div>
In your CSS change "b" to "#imgDiv img", "table" to "#imgDiv", and "table3" to "#adCol". Then either reduce the width of the borders or make one of them at least 10px smaller in width.
Don't forget to also remove the table2 tag and change whatever you've called b1 and b2 to use real HTML tags and change b1 and b2 in your CSS to class names or ids.
Also, consider not setting the width of the body. You probably don't need that.
In this case I see what your trying to accomplish but you should really use divs it would make it easier.
But why don't you just build (1) table with a layout like this below and place / position it in your content. Instead of creating multiple tables. You can still use CSS to add your effects.
<div id="apDiv3">
<table width="100%" height="335" border="1">
<tr>
<td width="87%" height="207">CONTENT</td>
<td width="13%" rowspan="2"><span class="style5">AD SPACE(Image)</span></td>
</tr>
<tr>
<td height="50">Footer</td>
</tr>
</table>
</div>
We don't have tag <table2>. You should use <table>.
If you want to bring two elements near each other, you have to create a div and set the display to flex and bring 2 or more elements into it. You have to set the width of elements to 50% if you want to bring 2 elements. If you want more, you must divide 100 to the number of elements. For example, if you want 5 elements next to each other you must set the width of elements to 20%.