I want to put two images on the left and a table on the right. At the moment I have one picture on the left, a table on the right and a blank space in the place where I want my another <img>. When I try to put my second <img> it remains on the left but under the table as it is 2x longer than the first image. Here's my code:
th { color: white; padding: 10px; }
td { color: white; padding: 10px; border-bottom: 1px solid aqua; }
tr { opacity: 0.8; }
tr:hover {background-color: #72FFBB;}
#td {
opacity: 0.2;
}
.table{
height: 654px;
float: left;
width: 55%;
border: 2px solid aqua;
text-align:center;
}
<!-- first picture -->
<div> <img id="VY_Canis_Majoris_vs_sun" src="VY_Canis_Majoris_vs_sun.png" width="44%" height="50%" style= "float: left;"> </div>
<!-- the one that should be under the first picture, but it is next to it -->
<div> <img id="VY_Canis_Majoris_vs_sun" src="Sol_VY_Canis_Majoris.png" width="44%" height="50%" style="z-index: -1;"> </div>
<div class="table"> <table width="100%" height="100%">
<tr>
<td>text</td>
<td> text</td>
</tr>
<tr>
<td>Mass</td>
<td>8 solar mass units </td>
</tr>
<tr>
<td>Radius</td>
<td>1,708 ± 192 R☉</td>
</tr>
<tr>
<td>Luminosity</td>
<td>340,000 L☉</td>
</tr>
<tr>
<td>Surface gravity</td>
<td>Surface gravity (log g) −0.5 cgs</td>
</tr>
<tr>
<td>Temperature</td>
<td>3,365±134 K</td>
</tr>
</table> </div>
Enclose the two pictures in one div
<div class="myimg">
<!-- first picture -->
<img id="VY_Canis_Majoris_vs_sun" src="VY_Canis_Majoris_vs_sun.png" width="44%" height="50%" style= "float: left;">
<!-- the one that should be under the first picture, but it is next to it -->
<img id="VY_Canis_Majoris_vs_sun" src="Sol_VY_Canis_Majoris.png" width="44%" height="50%" style="z-index: -1;"> </div>
<div class="table"> <table width="100%" height="100%">
<tr>
<td>text</td>
<td> text</td>
</tr>
<tr>
<td>Mass</td>
<td>8 solar mass units </td>
</tr>
<tr>
<td>Radius</td>
<td>1,708 ± 192 R☉</td>
</tr>
<tr>
<td>Luminosity</td>
<td>340,000 L☉</td>
</tr>
<tr>
<td>Surface gravity</td>
<td>Surface gravity (log g) −0.5 cgs</td>
</tr>
<tr>
<td>Temperature</td>
<td>3,365±134 K</td>
</tr>
</table> </div>
then add this css
.myimg{
float: left;
width: 44%;
}
give float:left to both image div tag.
th { color: white; padding: 10px; }
td { color: white; padding: 10px; border-bottom: 1px solid aqua; }
tr { opacity: 0.8; }
tr:hover {background-color: #72FFBB;}
.d1{
float:left;
height:100px;
width:100px;
}
#td {
opacity: 0.2;
}
.table{
height: 654px;
float: left;
width: 55%;
border: 2px solid aqua;
text-align:center;
}
<!-- first picture -->
<div class="d1"> <img id="VY_Canis_Majoris_vs_sun" src="VY_Canis_Majoris_vs_sun.png" width="44%" height="50%" style= "float: left;"> </div>
<!-- the one that should be under the first picture, but it is next to it -->
<div class="d1"> <img id="VY_Canis_Majoris_vs_sun" src="Sol_VY_Canis_Majoris.png" width="44%" height="50%" style="z-index: -1;"> </div>
<div class="table"> <table width="100%" height="100%">
<tr>
<td>text</td>
<td> text</td>
</tr>
<tr>
<td>Mass</td>
<td>8 solar mass units </td>
</tr>
<tr>
<td>Radius</td>
<td>1,708 ± 192 R☉</td>
</tr>
<tr>
<td>Luminosity</td>
<td>340,000 L☉</td>
</tr>
<tr>
<td>Surface gravity</td>
<td>Surface gravity (log g) −0.5 cgs</td>
</tr>
<tr>
<td>Temperature</td>
<td>3,365±134 K</td>
</tr>
</table> </div>
Maybe what you are looking for:
.container,
.images-container {
display: flex;
}
.container {
flex-direction: row;
}
.images-container,.table-container {
width:50%;
}
.images-container {
flex-direction: column;
}
.images-container img{
max-width:100%;
height:200px;
object-fit:cover;
}
/* Table styling */
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
table#t01 {
width: 100%;
background-color: #f1f1c1;
}
<div class='container'>
<div class='images-container'>
<img src="http://ste.india.com/sites/default/files/2016/12/30/559004-301216-gs-tch-10.jpg" />
<img src="http://www.dailypioneer.com/uploads/main/mn_story_image/T330_158723_Untitled-2.gif" />
</div>
<div class='table-container'>
<table id='t01' style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
</div>
</div>
You can group your images into 1 div and float this to the left.
<div id="pictures">
<img id="VY_Canis_Majoris_vs_sun" src="https://picsum.photos/400/400">
<img id="VY_Canis_Majoris_vs_sun" src="https://picsum.photos/400/400?image=42">
</div>
In your css you can give this div a width of 50% (and float it)
#pictures {
width: 50%;
float: left;
}
If you want your pictures under each other you can put display block on the images and make them fill the space (width: 100%)
#pictures img {
display: block;
width: 100%;
height: auto;
}
You put a border on your table so to make it fit you can put the width on 50% - 4px (2px border on each side). Use calc (short for calculate) for this:
.table {
width: calc(50% - 4px);
...
}
Here you can find all the code together: https://jsbin.com/rejuburaka/edit?html,css,output
Try This:
th {
color: white; padding: 10px;
}
td {
color: white;
padding: 10px;
border-bottom: 1px solid aqua;
}
tr {
opacity: 0.8;
}
tr:hover {
background-color: #72FFBB;
}
#td {
opacity: 0.2;
}
.table{
height: 654px;
float: left;
width: 55%;
border: 2px solid aqua;
text-align:center;
}
.wrapper {
float: left;
width: 30%;
}
div img {
width: 100%;
margin-bottom: 5px;
}
.table {
float: right;
width: 65%;
}
<div class="wrapper">
<div>
<img id="VY_Canis_Majoris_vs_sun" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRDAYrQr9qgT2W00EV_CoCahFki3Vw4lSMNt81k9FCSTXoKT8TY2w" width="44%" height="50%">
</div>
<div>
<img id="VY_Canis_Majoris_vs_sun" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQEnn9dYYZlciBKfaHCw17-dUgRPX3nq5_6-kV1ua-LIsId5g43uA" width="44%" height="50%" style="z-index: -1;">
</div>
</div>
<div class="table">
<table width="100%" height="100%">
<tr>
<td>text</td>
<td> text</td>
</tr>
<tr>
<td>Mass</td>
<td>8 solar mass units </td>
</tr>
<tr>
<td>Radius</td>
<td>1,708 ± 192 R☉</td>
</tr>
<tr>
<td>Luminosity</td>
<td>340,000 L☉</td>
</tr>
<tr>
<td>Surface gravity</td>
<td>Surface gravity (log g) −0.5 cgs</td>
</tr>
<tr>
<td>Temperature</td>
<td>3,365±134 K</td>
</tr>
</table>
</div>
I think you can't use <img /> tag under another <img /> tag because <img /> is a single line html tag. You can do something like this
<style>
.full-div{
width: 100%;
height: auto;
margin: 0 auto;
}
.left-side{
width: 100%;
height: auto;
margin: 0 auto;
}
.first-div,.second-div,.third-div{
width: 33%;
height: auto;
margin: 0 auto;
}
</style>
<div class="full-div">
<div class="left-side">
<div class="first-div">
<img src="your image source" />
</div>
<div class="second-div">
<img src="your image source" />
</div>
<div class="third-div">
<img src="your image source" />
</div>
</div>
<div class="right-side">
your table here
</div>
</div>
Related
I created this table:
table {
}
thead {
background-color: black;
color: white;
}
tbody, tr, td {
border: 1px solid black;
}
.cell-first-column {
width: 200px;
height: 70px;
}
.cell, th {
width: 100px;
height: 70px;
}
.td-cell {
height: 70px;
border: 1px solid black;
}
.chart {
position: relative;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
margin: 0
}
.chart-inner {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: gold;
}
.cell-text {
z-index: 10;
}
<table>
<thead>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
<th>Number</th>
</tr>
</thead>
<tr>
<td><div class="cell-first-column">Alfreds Futterkiste</div></td>
<td><div class="cell">Maria Anders</div></td>
<td><div class="cell">Germany</div></td>
<td><div class="cell">1234567</div></td>
</tr>
<tr>
<td><div class="cell-first-column">Centro comercial</div></td>
<td><div class="cell">Francisco Chang</div></td>
<td><div class="cell">Mexico</div></td>
<td><div class="cell">1234567</div></td>
</tr>
<tr>
<td><div class="cell-first-column">Opla</div></td>
<td class="td-cell">
<div class="chart">
<div class="chart-inner" style="height: 90%"></div>
<div class="cell-text">Charles Boule</div>
</div>
</td>
<td class="td-cell">
<div class="chart">
<div class="chart-inner" style="height: 30%"></div>
<div class="cell-text">France</div>
</div>
</td>
<td class="td-cell">
<div class="chart">
<div class="chart-inner" style="height: 50%"></div>
<div class="cell-text">1234567</div>
</div>
</td>
</tr>
</table>
inside the third row, the cells are colored and to do that I use absolute position.
It works but I don't understand why the yellow doesn't take the entire cell space, there is a white margin between the yellow and the cell border.
Margins are 0.
How it is now vs How I would like it to be:
Why? How can I solve?
Thanks a lot
Set padding of td to 0 should fix the issue.
The correct way:
<table cellpadding="0">
I am trying to make a table mobile responsive. The first thing I would love to do is to decrease the width size of the table headings and then enable the table data to have one complete row for each data.
I am trying to get my table to look like the attached picture on mobile.
.email-table table{
margin-left: 40px;
font-family: 'Roboto', sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border-top: 1px solid #dddddd;
border-bottom: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
td{
font-size: 1.2rem;
}
td:last-of-type{
font-weight: 700;
}
.attachment{
display: flex;
justify-content: center;
width: 20%;
align-items: center;
}
.first-clip span:last-of-type{
margin-right: 20px;
}
.last-clip{
margin-left: 25px;
}
.attachment span:last-of-type{
flex-shrink: 0;
}
.attachment span:first-of-type img{
width: 20px;
height: 20px;
}
.text-attachment{
display: flex;
justify-content: space-around;
}
.text-attachment span:first-of-type{
transform: translateX(-18px);
}
.second-text{
transform: translateX(5px);
}
.text-attachment span:last-of-type{
border: 1px solid #ccc;
background-color: #5E5D5D;
color: white;
border-radius: 5px;
padding: 0px 5px;
}
.second-text span:last-of-type{
transform: translateX(-10px);
}
td img{
width: 20px;
height: 20px;
transform: translateX(-30px);
}
th{
background-color: #EEEDED;
border-top: 3px solid #dddddd;
border-bottom: 3px solid #dddddd;
}
th:not(:last-child){
color: #5E5D5D;
}
.date>span img{
height: 10px;
width: 10px;
padding-left: 3px;
}
tr:not(:first-of-type):hover{
cursor: pointer;
color: blue;
background-color: #EEEDED;
}
<div class="email-table">
<table>
<tr>
<th>From</th>
<th>To</th>
<th>Subject</th>
<th class="date">Date <span><img src="./assets/icon_arrow01.svg" alt=""></span></th>
</tr>
<tr>
<td>aaa#example.com</td>
<td>zzz.zzz#example.com</td>
<td>[ HR-888 ] Notice of official announcement</td>
<td>0:20</td>
</tr>
<tr>
<td>bbb.bbbb#exam... </td>
<td>yyy#example.com</td>
<td>[web:333] "Web Contact"</td>
<td>0:10</td>
</tr>
<tr>
<td>ccc#example.com </td>
<td>
<div class="text-attachment">
<span>xxx#example.com, ...</span>
<span>+1</span>
</div>
</td>
<td>Happy New Year! Greetings for the New Year.</td>
<td>
<div class="attachment first-clip">
<span><img src="./assets/icon_clip.svg" alt=""></span>
<span>0:00</span>
</div>
</td>
</tr>
<tr>
<td>ddd.dddd#exam...</td>
<td>
<div class="text-attachment second-text">
<span>vvv.vvv#example.com, ... </span>
<span>+1</span>
</div>
</td>
<td>[HR-887(Revised: Office Expansion Project Team)] Notice of off... </td>
<td>Jan 01 </td>
</tr>
<tr>
<td>eee#example.com</td>
<td>
<div class="text-attachment">
<span>sss#example.com, .... </span>
<span>+2</span>
</div>
</td>
<td>[Github] Logout page</td>
<td>Jan 01</td>
</tr>
<tr>
<td>fff.ffff#example.c... </td>
<td>qqq.qqq#example.com</td>
<td>[dev] Postfix 3.1.12 / 3.2.9 / 3.3.4 / 3.4.5</td>
<td>Jan 01</td>
</tr>
<tr>
<td>ggg#example.com </td>
<td>ppp#example.com</td>
<td>Re: [Github] Brush-up on loading animation </td>
<td>Jan 01</td>
</tr>
<tr>
<td>hhh.hhh#examp...</td>
<td>ooo.ooo#example.com</td>
<td>Workplace Summary for sample, Inc.: Jun 2 - Jun 9</td>
<td>
<div class="attachment">
<span><img src="./assets/icon_clip.svg" alt=""></span>
<span>Jan 01</span>
</div>
</td>
</tr>
<tr>
<td>iii#example.com</td>
<td>nnn#example.com</td>
<td>I love you</td>
<td>
<div class="attachment last-clip">
<span><img src="./assets/icon_clip.svg" alt=""></span>
<span>2019/12/31</span>
</div>
</td>
</tr>
<tr>
<td>Pablo-Diego-...</td>
<td>Pablo-Diego-José-Francisc...
</td>
<td>[info:888] ABC EQUIPMENT COMPANY</td>
<td>2019/12/31</td>
</tr>
</table>
</div>
I, first of all, tried to make the header much smaller but that does not even work. I am totally lost at the steps I need to take to make this look good on mobile.
The trick for this sort of layout is to throw away the default table styling entirely.
Use display: contents to stop the tbody element from generating a box. Then use display: flex on the table to make it lay out the tr elements in a non-tabular column.
Then each tr can be styled as a CSS Grid, and the various elements positioned on that.
#media screen and (max-width: 1000px) {
body {
background: #AAA
}
table {
display: flex;
flex-direction: column;
margin: 0 10%;
background: white;
}
tbody,
tfoot {
display: contents;
}
thead {
display: none;
}
tr {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr;
gap: 1px 1px;
grid-template-areas: "From Date" "To Date" "Subject Date";
border-bottom: solid #aaa 1px;
}
td {
padding: 3px;
}
td:nth-child(1) {
grid-area: From;
}
td:nth-child(2) {
grid-area: To;
}
td:nth-child(3) {
grid-area: Subject;
}
td:nth-child(4) {
grid-area: Date;
text-align: right;
}
}
<div class="email-table">
<table>
<thead>
<tr>
<th>From</th>
<th>To</th>
<th>Subject</th>
<th class="date">Date <span><img src="./assets/icon_arrow01.svg" alt=""></span></th>
</tr>
</thead>
<tr>
<td>aaa#example.com</td>
<td>zzz.zzz#example.com</td>
<td>[ HR-888 ] Notice of official announcement</td>
<td>0:20</td>
</tr>
<tr>
<td>bbb.bbbb#exam... </td>
<td>yyy#example.com</td>
<td>[web:333] "Web Contact"</td>
<td>0:10</td>
</tr>
<tr>
<td>ccc#example.com </td>
<td>
<div class="text-attachment">
<span>xxx#example.com, ...</span>
<span>+1</span>
</div>
</td>
<td>Happy New Year! Greetings for the New Year.</td>
<td>
<div class="attachment first-clip">
<span><img src="./assets/icon_clip.svg" alt=""></span>
<span>0:00</span>
</div>
</td>
</tr>
<tr>
<td>ddd.dddd#exam...</td>
<td>
<div class="text-attachment second-text">
<span>vvv.vvv#example.com, ... </span>
<span>+1</span>
</div>
</td>
<td>[HR-887(Revised: Office Expansion Project Team)] Notice of off... </td>
<td>Jan 01 </td>
</tr>
<tr>
<td>eee#example.com</td>
<td>
<div class="text-attachment">
<span>sss#example.com, .... </span>
<span>+2</span>
</div>
</td>
<td>[Github] Logout page</td>
<td>Jan 01</td>
</tr>
<tr>
<td>fff.ffff#example.c... </td>
<td>qqq.qqq#example.com</td>
<td>[dev] Postfix 3.1.12 / 3.2.9 / 3.3.4 / 3.4.5</td>
<td>Jan 01</td>
</tr>
<tr>
<td>ggg#example.com </td>
<td>ppp#example.com</td>
<td>Re: [Github] Brush-up on loading animation </td>
<td>Jan 01</td>
</tr>
<tr>
<td>hhh.hhh#examp...</td>
<td>ooo.ooo#example.com</td>
<td>Workplace Summary for sample, Inc.: Jun 2 - Jun 9</td>
<td>
<div class="attachment">
<span><img src="./assets/icon_clip.svg" alt=""></span>
<span>Jan 01</span>
</div>
</td>
</tr>
<tr>
<td>iii#example.com</td>
<td>nnn#example.com</td>
<td>I love you</td>
<td>
<div class="attachment last-clip">
<span><img src="./assets/icon_clip.svg" alt=""></span>
<span>2019/12/31</span>
</div>
</td>
</tr>
<tr>
<td>Pablo-Diego-...</td>
<td>Pablo-Diego-José-Francisc...
</td>
<td>[info:888] ABC EQUIPMENT COMPANY</td>
<td>2019/12/31</td>
</tr>
</table>
</div>
I am working on an assignment for school which is designing an app with HTML. I am having trouble with the contents of the apps bleeding over at the bottom when you scroll down. I tried various options of the overflow method and nothing seems to work. I included the entire css and html. Thanks to anyone who takes the time to help me out!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="CSS/reset.css">
<link rel="stylesheet" href="CSS/style.css">
<link href=https://fonts.googleapis.com/css?family='Roboto' rel='stylesheet'>
</head>
<body>
<div id="table-wrapper">
<div id="table-scroll">
<section class="container">
<nav>
<img src="images/status bar.png" width="360" height="24" alt=""/>
<div class="app-bar">
<table width="100%" border="0">
<tbody>
<tr>
<td class="ham-menu"><img src="images/menu.png" width="24" height="24" alt=""/></td>
<td class="title">Washington at State Station</td>
<td class="search-icon"><img src="images/search.png" width="24" height="24" alt=""/></td>
<td class="icon"><img src="images/menu-item.png" width="5" height="24" alt=""/></td>
</tr>
</tbody>
</table>
</div>
<div class="route-bar"><table width="100%" border="0">
<tbody>
<tr>
<td class="lines"><h2>Line</h2></td>
<td class="dest"><h2>Destination</h2></td>
<td class="times"><h2>Arrival</h2></td>
</tr>
</tbody>
</table>
</div>
</nav>
<section class="bus-list">
<div class="info">
<table width="100%" border="0">
<tbody>
<tr>
<td class="lines"><h1>124</h1></td>
<td class="dest"><h1>Eastbound</h1>
<h3>Navy Pier</h3></td>
<td class="times"><h1>5 Min</h1>
<h3>Freq. 10 min</h3>
</td>
</tr>
</tbody>
</table>
</div>
<div class="info">
<table width="100%" border="0">
<tbody>
<tr>
<td><h1>124</h1></td>
<td class="dest"><h1>Southbound</h1> <h3>Navy Pier</h3></td>
<td class="times"><h1>10 Min</h1>
<h3>Freq. 10 min</h3>
</td>
</tr>
</tbody>
</table>
</div>
<div class="info">
<table width="100%" border="0">
<tbody>
<tr>
<td><h1>J14</h1></td>
<td class="dest"><h1>Southbound</h1>
<h3>103rd/Stony Island</h3></td>
<td class="times"><h1>15 Min</h1>
<h3>Freq. 15 min</h3></td>
</tr>
</tbody>
</table>
</div>
<div class="info">
<table width="100%" border="0">
<tbody>
<tr>
<td class="lines"><h1>151</h1></td>
<td class="dest"><h1>Northbound</h1>
<h3>Devon/Clark</h3></td>
<td class="times"><h1>16 Min</h1>
<h3>Freq. 16 min</h3></td>
</tr>
</tbody>
</table>
</div>
<div class="info">
<table width="100%" border="0">
<tbody>
<tr>
<td class="lines"><h1>60</h1></td>
<td class="dest"><h1>Eastbound</h1>
<h3>Randolph/Harbor Dr</h3></td>
<td class="times"><h1>18 Min</h1>
<h3>Freq. 20 min</h3></td>
</tr>
</tbody>
</table>
</div>
<div class="info">
<table width="100%" border="0">
<tbody>
<tr>
<td class="lines"><h1>6X</h1></td>
<td class="dest"><h1>Reroute</h1>
<h3>Jackson Park Express</h3>
</td>
<td class="times"><h1>30 Min</h1>
<h3>Freq. N/A</h3></td>
</tr>
</tbody>
</table>
</div>
<div class="info">
<table width="100%" border="0">
<tbody>
<tr>
<td class="lines"><h1>4</h1></td>
<td class="dest"><h1>Out of Service</h1>
<h3>Cottage Grove</h3>
<h3>Resumes 12:10 am</h3></td>
<td class="alert">
</td>
</tr>
</tbody>
</table>
</div>
<div class="info">
<table width="100%" border="0">
<tbody>
<tr>
<td class="lines"><h1>20</h1></td>
<td class="dest"><h1>Out of Service</h1>
<h3>Madison</h3>
<h3>Resumes 12:10 am</h3></td>
</td>
<td class="alert">
</td>
</tr>
</tbody>
</table>
</div>
<div class="info">
<table width="100%" border="0">
<tbody>
<tr>
<td class="lines"><h1>157</h1></td>
<td class="dest"><h1>Out of Service</h1>
<h3>Streeterville/Taylor</h3>
<h3>Resumes 6:00 am</h3></td>
<td class="alert">
</td>
</tr>
</tbody>
</table>
</div>
</section>
<footer class="footer"></footer>
</section>
</div>
</div>
</body>
</html>
CSS
*, *:before, *:after {
box-sizing: border-box;
}
body {
background-color: #6E6C6C;
font-family: 'Roboto';
font-size: 16px;
color: #ffffff;
margin-top: 75px;
}
#table-wrapper {
position: relative;
}
#table-scroll {
height: 647px;
overflow: auto;
}
h1 {
font-size: 18px;
font-weight:600;
line-height: 1.3em;
color:#02356A;
}
h3 {
font-size: 14px;
font-weight: 400;
line-height: 1.3em;
color:#02356A;
}
.container {
margin: 0 auto;
width: 360px;
height: 667px;
}
nav {
margin: 0 auto;
position: fixed;
width: 360px;
height: 111px;
background-color: #164F9C;
}
.bus-list {
padding-top: 158px;
width: 100%;
padding-bottom: 50px;
}
.info {
text-align: left;
padding: 16px;
width: 100%;
background-color: #e5edf2;
border-bottom: thin #000000 solid;
}
.info:hover {
background-color: #81aef1;
}
.content {
width: 90%;
display:inline-block;
}
.icon {
width: 4px;
padding-left: 24px;
}
.title {
font-size: 20px;
color: #ffffff;
width: 180px;
padding-left: 32px;
vertical-align: middle;
line-height: 1.3em;
}
.ham-menu {
width: 24px;
}
.search-icon {
padding-left: 24px;
width: 24px;
}
.app-bar {
padding: 16px;
}
.route-bar {
background-color:#02356A;
height: 48px;
width: 360px;
text-align: left;
padding: 16px;
}
.lines {
text-align: left;
width: 100px;
}
.dest {
width: 37%;
}
.times {
width: 27%;
text-align: right;
}
.bottom-bar {
background-color: #000000;
margin-top: 425px;
}
.alert {
background-image: url(file:///C:/Users/Steve/bloc/frontend/images/alerts.png);
background-repeat: no-repeat;
background-size: 42px 38px;
background-position: right;
width: 27%;
}
.footer {
position: fixed;
background-color: #000000;
width: 360px;
bottom: 37px;
height: 48px;
background-image:url(file:///C:/Users/Steve/bloc/frontend/images/bottom-bar.png);
background-size: cover;
}
You have a bottom: 37px; in your CSS in the footer. Set this to 0px and you won't see the element under it anymore.
I'm trying to reproduce this for a Newsletter, with the text and images centred.
This is what I have so far
I was trying to add the border-collapse: collapse; property and also to add border left and right but I'm stacked. If you have any suggestions how to create the vertical lines and cantered the text and images I would deeply appreciate any help.
<table class="outer-table-2">
<tr>
<td class="three-column">
<div class="section">
<table width="100%">
<tr>
<td class="inner-td">
<table class="content">
<tr>
<td class="text">
<p>01628531300</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="section">
<table width="100%">
<tr>
<td class="inner-td">
<table class="content">
<tr>
<td>
<div id="callout">
<ul class="social">
<li><img src="facebook.png"></li>
<li><img src="twitter.png"></li>
<li><img src="linkedin.png"></li>
</ul>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="section">
<table width="100%">
<tr>
<td class="inner-td">
<table class="content">
<tr>
<td class="text">
<p>www.cdvi.co.uk<p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<style>
.outer-table-2 {
width: 100%;
max-width: 670px;
margin: 12px auto;
border: 3px solid #00467f;
}
.three-column {
}
.three-column .section {
width: 100%;
max-width: 200px;
display: inline-block;
vertical-align: top;
background-color: #FFFFf;
}
.three-column .social {
width: 100%;
height: 10px;
margin: 0 0 5px 0;
}
.outer-table-2 p {
margin:10px 10px 10px 40px;
color: #00467f;
font-size: 12px;
font-weight: 1000 !important;
line-height: 10px;
}
.middle-table {
margin: auto;
padding-top: 10px;
}
.middle-table img{
width: 120px;
height: 80px;
}
</style>
I think you are massively over-complicating this. You only need one table to recreate a layout similar to your image.
table {
width: 100%;
border-collapse: collapse;
}
tr {
height: 60px;
}
td {
text-align: center;
}
.b-t {
border-top: 5px solid darkblue;
}
.b-l {
border-left: 5px solid darkblue;
}
.b-r {
border-right: 5px solid darkblue;
}
ul {
list-style: none;
margin: 0;
padding: 0;
}
li {
display: inline-block;
}
<table>
<tr>
<td class="b-t b-r">01628531300</td>
<td class="b-t">
<ul class="social">
<li><img src="facebook.png"></li>
<li><img src="twitter.png"></li>
<li><img src="linkedin.png"></li>
</ul>
</td>
<td class="b-t b-l">
www.cdvi.co.uk
</td>
</tr>
</table>
I have table cells with class=image to which I cannot seem to apply any CSS. Here is my markup (nested tables) where the first table shows an example of a typical row:
<table class="outer">
<tr>
<td>
<table class="column" id="leftColumn">
<tr>
<td>
<table class="cell" id="t1">
<tr>
<td><asp:Literal runat="server" ID="t1r2c1" /></td>
<td class="image">
<span id="s1" runat="server">
<asp:PlaceHolder ID="p1" runat="server">
</asp:PlaceHolder>
</span>
</td>
<td><asp:Literal runat="server" ID="t1r2c3" /></td>
<td class="gray"><asp:Literal runat="server" ID="t1r2c4" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table class="cell" id="t2">
</table>
</td>
</tr>
</table>
</td>
<td>
<table class="column" id="rightColumn">
<tr>
<td>
<table class="cell" id="t3">
</table>
</td>
</tr>
<tr>
<td>
<table class="cell" id="t4">
</table>
</td>
</tr>
<tr>
<td>
<table class="cell" id="t5">
</table>
</td>
</tr>
<tr>
<td>
<table class="cell" id="t6">
</table>
</td>
</tr>
<tr>
<td>
<table class="cell" id="t7">
</table>
</td>
</tr>
<tr>
<td>
<table class="cell" id="t8">
</table>
</td>
</tr>
<tr>
<td>
<table class="messages" id="t9">
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
Here is my CSS:
.outer
{
border: none;
margin-left: auto;
margin-right: auto;
}
.outer td
{
vertical-align: top;
}
.column
{
border: none;
}
#rightColumn table, #leftColumn table
{
width: 100%;
}
.cell
{
border-collapse: collapse;
border: 2px solid black;
margin: 5px;
}
.cell td
{
border-collapse: collapse;
border: 2px solid black;
text-align: center;
vertical-align: middle;
padding-left: 3px;
padding-right: 3px;
padding-top: 0px;
padding-bottom: 0px;
font-size: 11pt;
}
.cell .image
{
padding: 0;
margin: 0;
height: 2px;
width: 7px;
}
.messages td
{
border-collapse: collapse;
border: 2px solid #FF0000;
text-align: left;
}
h1
{
text-align: center;
font-size: 150%;
}
h2
{
text-align: center;
}
th
{
height: 24px;
background-color: #2B60DE;
color: #FFFFFF;
}
.gray
{
background-color: #AAAAAA;
}
Nothing I do to .cell .image seems to be able to shrink the images below a certain size -- which is already much smaller than the actual images so I know some shrinking is already going on.
Any advice is appreciated.
Could be the line-height or font-size preventing the td to become smaller.
Try setting the tds of the row with the image to line-height: 0px and font-size: 0px
I put together a jsfiddle of your example at http://jsfiddle.net/9xLqY/. The styles are being applied just fine when I remove the ASP components:
<span id="s1" runat="server">
<asp:PlaceHolder ID="p1" runat="server"></asp:PlaceHolder>
</span>
So it must be one of these components that is forcing the cells to be larger than you want. You'll need to add styles for #s1 and #p1.