This is my page header, it has a select menu and has to be positioned well on top of the background image, how do I fix it in position when screen resolution changes ?
Take a look
here on a bigger resolution
the html looks as follows:
<div class="header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td style="padding: 16px 10px 0 52px ;text-align: right; width: 230px; background: url('images/searchbar_dropdown.png') no-repeat scroll 72px 15px transparent;">
<select id="dept" name="dept" type="text" style="background-color: white; border: 2px solid rgb(182, 109, 49); width: 150px; height: 35px; opacity: 0;"><option></option>
</select></div></td>
<td rowspan="2" style="width: 2px;"> </td>
</tr>
</table>
</div>
and the header CSS
.header {
background: url("../../images/background.png") repeat;
position: fixed;
color: white;
min-height: 65px;
padding: 5px 5px;
margin: 0;
}
The select is flowing out for you because the fixed position
You will need a wrapper around the box with a position relative and the box as position absolute
Example:
<div id="boxWrapper">
<select class="selectbox">
<option value="">option 1</option>
<option value="">option 2</option>
<option value="">option 3</option>
</select>
</div>
#boxWrapper {
position: relative:
}
.selectbox {
position: absolute;
top: 0px;
left: 0px;
}
I believe it is likely a combination of your width: 100% on the table and your text-align: right on your td. I suspect your td is not acting as you want, and not keeping its width: 230px, but is expanding with the screen width along with the table. With the text-align: right the select element is then moving also. The easiest fix would be to position the select such that it is text-align: left, unless you intend it to be right and the background to follow (in which case how you have the background attached is what you need to correct).
Try this code
<div class="header">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td style="padding: 16px 10px 0px 52px; text-align: right; width: 230px; background: none repeat scroll 0% 0% whitesmoke; position: relative;">
<select style="border: 2px solid rgb(182, 109, 49); height: 35px; background: none repeat scroll 0% 0% yellow; opacity: 1; position: absolute; width: 150px; left: 0px;" type="text" name="dept" id="dept"><option></option>
</select></td>
<td style="width: 2px;" rowspan="2"> </td>
</tr>
</tbody></table>
</div>
Related
I've seen a lot of answers to this question using things like relative and absolute positioning, making line heights very small, etc. to achieve the effect I'm looking for. Since I'm trying to develop the same thing for emails, this is not as simple. I can achieve one line on either side of a header, but not two lines. Essentially it would look like -----My Header---- Here's my code for one line on either side
<tr>
<td valign="top" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; table-layout: fixed; width: 100%; margin: 0 auto; padding-bottom: 20px;">
<a href="#" style="display: block; word-wrap: break-word; max-width: 100%; text-decoration: none; height: 100%; margin: 0 auto;">
<div class="header" style="display: table; text-align: center; margin: 0 auto; color: #000000; font-weight: 600; line-height: 130%; letter-spacing: 0.2px; font-size: 18px; width: 100%; max-width: 550px;">
<span style="display: table-cell; width: 20%; vertical-align: middle; padding-right: 10px;"><hr style="background-color: #000000; height: 3px;" /></span>MY HEADER
<span style="display: table-cell; width: 20%; vertical-align: middle; padding-left: 10px;"><hr style="height: 3px; background-color: #000000;" /></span>
</div>
</a>
</td>
</tr>
If that doesn't run, I might've made a typo. But either way, in gmail it renders just fine.
But how would one make it with two lines on either side? I'm at a complete loss for how to do this in email. Any advice would be great - thanks!
I was able to get the desired result by using absolute positioning. The trick to absolute positioning is to set the parent element to position: relative
I additionally set the "My heading" in its own span with the padding to keep the horizontal bars at bay
EDIT: I removed the display: table-cell because it was unnecessary.
This should work
<table>
<tbody>
<tr>
<td valign="top" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; table-layout: fixed; width: 100%; margin: 0 auto; padding-bottom: 20px;">
<a href="#" style="display: block; word-wrap: break-word; max-width: 100%; text-decoration: none; height: 100%; margin: 0 auto;">
<div class="header" style="text-align: center; margin: 0 auto; color: #000000; font-weight: 600; line-height: 130%; letter-spacing: 0.2px; font-size: 18px; width: 100%; max-width: 550px;position: relative;">
<span style="width: 20%; vertical-align: middle; position: absolute;top: 0;left: -10px;"><hr style="background-color: #000000; height: 3px;" /></span>
<span style="padding: 0 25px;"> MY HEADER</span>
<span style="width: 20%; vertical-align: middle; position: absolute;top: 0;right: -10px;"><hr style="height: 3px; background-color: #000000;" /></span>
</div>
</a>
</td>
</tr>
</tbody>
</table>
You'll need to use a table with three columns. You can't simply change things with display (so, don't even try to use a span with padding - spans are inline, not block), nor is positioning widely supported.
<table>
<tbody>
<tr>
<td valign="top" style="border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; table-layout: fixed; width: 100%; margin: 0 auto; padding-bottom: 20px">
<table width="100%">
<tr>
<td width="20%"><hr style="background-color: #000000; height: 3px;min-width:20px" /></td>
<td width="60%"><p style="padding: 0 25px;text-align: center;">MY HEADER</p></td>
<td width="20%"><hr style="background-color: #000000; height: 3px;min-width:20px" /></td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
I have a HTML file in which the coding for the 'page' part is as below:
#page { margin: 2% 0% 0% 2%;}
.page { BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; WIDTH: 0px; BORDER-BOTTOM: 0px;}
.pageBreak{ page-break-before: always;position:relative; WIDTH: 0px; }
.page1 { BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; WIDTH: 675px; HEIGHT:900px; BORDER-BOTTOM: 0px;}
<table class="page1">
<tr>
<td colspan="2">
<div
style="z-index: 10; top: 10px; left: 14px; width: 730px; height: 1015px; border-color: #000000; border-style: solid; border-width: 1px;">
<table width="730px" height="1015px">
<tr>
<td> </td>
</tr>
</table>
</div>
//some code here......
</table>
<table class="page">
<tr>
<td colspan="2">
<div
style="z-index: 10; top: 10px; left: 14px; width: 730px; height: 1015px; border-color: #000000; border-style: solid; border-width: 1px;">
<table width="730px" height="1015px">
<tr>
<td> </td>
</tr>
</table>
</div>
//some code here......
</table>
Our client requirement is that when print option is selected as 'Shrink to Fit',the print preview and the print is displaying the page which is not getting fit to the A4 size width and height.It is leaving a lot of space at the right border and bottom. So,please suggest as what can be made to meet the requirement i.e. selecting the page with 'Shrink to Fit' should result in page occupying the 90% of whole A4 sheet leaving the other 10% for borders. The issue is observed for all the browser versions of IE and FF. Chrome is not in our scope.
This question already has answers here:
overflow:hidden not working when using tables
(4 answers)
Closed 5 years ago.
Here is some kinda complicated html table formatting I have:
http://jsfiddle.net/nyCKE/8517/
The problem is that the "Subject Areas" table does not work when I try to do overflow scroll. It has a height set to 200px, but when I add many rows to the table, it doesn't stay at 200, it just keeps extending the table. As you can see on the jsfiddle, I have tbody set to overflow-y scroll (I want the thead to be fixed). But, it refuses to scroll. The "Classes" table has no data so it stays at 200px. That is what I want the height of the subject areas table to be, but clearly it is bigger. Here is some of the relevant css:
tbody {
overflow-y scroll;
}
.subjects{
width:100%;
height: 200px;
}
.classes {
width:100%;
height: 200px;
margin-top: 5px;
}
Another thing I forgot to mention is I have 2 div's, one for left and one for right. The left div contains the subjects and classes tables. The right div contains the overview. This is for when the window is bigger and by extending the window in the fiddle, you can see that the overview table goes to the right, which is what I want. I am not sure if these div's mess up the tbody scrolling.
Does anyone know how to solve my problem?
Bug in your css:
tbody {
overflow-y scroll;
}
should be:
tbody {
overflow-y: scroll;
}
Solution to your problem: define your height directly at child and use display: block
tbody {
overflow-y: scroll;
display: block;
height: 200px;
}
body {
background: #6CD3F8;
/*background: -webkit-linear-gradient(top left, #6CD3F8 0%, #E0F7FE 100%);
background: linear-gradient(to bottom right, #6CD3F8 0%, #E0F7FE 100%);*/
}
h3 {
color: white;
text-align: left;
margin-top: 20px;
}
.scan {
padding: 0% 10%;
}
table {
background: #E0F7FE;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
table td,
table td * {
vertical-align: top;
}
tbody {
overflow-y: scroll;
display: block;
height: 200px;
}
th {
color: #265C82;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: normal;
font-size: 17px;
padding-left: 5px;
padding-top: 5px;
}
td {
padding-left: 10px;
}
::-webkit-input-placeholder {
color: #00B2F3;
}
.search {
color: #00B2F3;
border: 0px solid red;
border-radius: 10px;
width: calc(100% - 10px);
height: 35px;
margin-top: 5px
}
.select {
width: calc(100% - 10px);
}
.icon {
width: 20px;
height: 20px;
margin: 2px 8px 0px 5px;
float: left;
}
hr {
border-color: #00B2F3;
margin: 3px 0;
width: calc(100% - 5px);
}
.subjects {
width: 100%;
height: 200px;
}
.classes {
width: 100%;
height: 200px;
margin-top: 5px;
}
.sections {
width: 100%;
height: 405px;
}
.left {
width: 50%;
float: left;
margin-right: 5px;
margin-bottom: 3%;
min-width: 300px;
}
.right {
width: calc(50% - 10px);
float: left;
min-width: 300px;
margin-bottom: 3%;
}
.mid {
width: 100%;
text-align: center;
float: left;
position: relative;
}
.wrapper {
width: 100%;
text-align: right;
float: left;
position: relative;
}
.logo {
max-width: 30%;
margin: 10px 0px;
}
.links > a {
color: rgba(255, 255, 255, 0.8);
font-size: 16px;
padding: 0px 10px;
}
.links {
/*padding-left: 100px;*/
padding-bottom: 10px;
}
<body>
<div class="scan">
<h3>Summer Session A</h3>
<!-- <div class="left">
left
</div> -->
<!-- <div class="right">
right
</div> -->
<div class="left">
<table class="subjects">
<thead>
<tr>
<th>
<div>Subject Areas</div>
<hr>
</th>
</tr>
<tr>
<th>
<input type="text" class="form-control search" onkeyup="searchFunction('subjects')" placeholder="Search...">
</th>
</tr>
</thead>
<tbody>
<tr>
<td>Computer Science</td>
</tr>
<tr>
<td>Mathematics</td>
</tr>
<tr>
<td>Engineering</td>
</tr>
<tr>
<td>Computer Science</td>
</tr>
<tr>
<td>Mathematics</td>
</tr>
<tr>
<td>Engineering</td>
</tr>
<tr>
<td>Computer Science</td>
</tr>
<tr>
<td>Mathematics</td>
</tr>
<tr>
<td>Engineering</td>
</tr>
<tr>
<td>Computer Science</td>
</tr>
<tr>
<td>Mathematics</td>
</tr>
<tr>
<td>Engineering</td>
</tr>
<!-- <select class="form-control" id="exampleSelect1">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select> -->
<!-- <tr>
<td>
<select class="form-control select">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</td>
</tr> -->
</tbody>
</table>
<table class="classes">
<thead>
<tr>
<th>
Classes
<hr>
</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</div>
<div class="right">
<table class="sections">
<thead>
<tr>
<th>
Overview
<hr>
</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
You can wrap the table in a container and give the height and overflow to the container.
body {
background: #6CD3F8;
/*background: -webkit-linear-gradient(top left, #6CD3F8 0%, #E0F7FE 100%);
background: linear-gradient(to bottom right, #6CD3F8 0%, #E0F7FE 100%);*/
}
h3 {
color: white;
text-align: left;
margin-top: 20px;
}
.scan {
padding: 0% 10%;
}
table {
background: #E0F7FE;
}
table,
.tableContainer {
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
table td,
table td * {
vertical-align: top;
}
tbody {
overflow-y scroll;
}
th {
color: #265C82;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: normal;
font-size: 17px;
padding-left: 5px;
padding-top: 5px;
}
td {
padding-left: 10px;
}
::-webkit-input-placeholder {
color: #00B2F3;
}
.search {
color: #00B2F3;
border: 0px solid red;
border-radius: 10px;
width: calc(100% - 10px);
height: 35px;
margin-top: 5px
}
.select {
width: calc(100% - 10px);
}
.icon {
width: 20px;
height: 20px;
margin: 2px 8px 0px 5px;
float: left;
}
hr {
border-color: #00B2F3;
margin: 3px 0;
width: calc(100% - 5px);
}
.subjectsContainer {
height: 200px;
overflow: scroll;
}
.subjects {
width: 100%;
}
.classes {
width: 100%;
height: 200px;
margin-top: 5px;
}
.sections {
width: 100%;
height: 405px;
}
.left {
width: 50%;
float: left;
margin-right: 5px;
margin-bottom: 3%;
min-width: 300px;
}
.right {
width: calc(50% - 10px);
float: left;
min-width: 300px;
margin-bottom: 3%;
}
.mid {
width: 100%;
text-align: center;
float: left;
position: relative;
}
.wrapper {
width: 100%;
text-align: right;
float: left;
position: relative;
}
.logo {
max-width: 30%;
margin: 10px 0px;
}
.links > a {
color: rgba(255, 255, 255, 0.8);
font-size: 16px;
padding: 0px 10px;
}
.links {
/*padding-left: 100px;*/
padding-bottom: 10px;
}
<body>
<div class="scan">
<h3>Summer Session A</h3>
<!-- <div class="left">
left
</div> -->
<!-- <div class="right">
right
</div> -->
<div class="left">
<div class="subjectsContainer tableContainer">
<table class="subjects">
<thead>
<tr>
<th>
<div>Subject Areas</div>
<hr>
</th>
</tr>
<tr>
<th>
<input type="text" class="form-control search" onkeyup="searchFunction('subjects')" placeholder="Search...">
</th>
</tr>
</thead>
<tbody>
<tr>
<td>Computer Science</td>
</tr>
<tr>
<td>Mathematics</td>
</tr>
<tr>
<td>Engineering</td>
</tr>
<tr>
<td>Computer Science</td>
</tr>
<tr>
<td>Mathematics</td>
</tr>
<tr>
<td>Engineering</td>
</tr>
<tr>
<td>Computer Science</td>
</tr>
<tr>
<td>Mathematics</td>
</tr>
<tr>
<td>Engineering</td>
</tr>
<tr>
<td>Computer Science</td>
</tr>
<tr>
<td>Mathematics</td>
</tr>
<tr>
<td>Engineering</td>
</tr>
<!-- <select class="form-control" id="exampleSelect1">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select> -->
<!-- <tr>
<td>
<select class="form-control select">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</td>
</tr> -->
</tbody>
</table>
</div>
<table class="classes">
<thead>
<tr>
<th>
Classes
<hr>
</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</div>
<div class="right">
<table class="sections">
<thead>
<tr>
<th>
Overview
<hr>
</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
I'm trying to make the black bar from the table td reach out all the way to the black border of the div. what am I doing wrong? I've been messing around with this for a while now and its starting to get to me. :( I've included all the css and html below. Hopefully someone can give me a hand with this. Thanks in advance!
<div style="background: #DCDCDC;border: 1px solid #000000;border-radius: 12px; vertical-align: top;width: 240px;height: 180px;">
<table width="100%">
<tr>
<td bgcolor="#000000" height="15"></td>
</tr>
<tr>
<td>f</td>
</tr>
</table>
</div>
You need overflow: hidden to hide the style outside of the parent.
border-spacing: 0 to remove the default spacing of the table.
* {
margin: 0;
padding: 0;
}
div {
background: #DCDCDC;
border: 1px solid #000000;
border-radius: 12px;
vertical-align: top;
width: 240px;
height: 180px;
overflow: hidden;
}
table {
border-spacing: 0;
width: 100%; }
<div>
<table>
<tr><td bgcolor="#000000" height="15"></td></tr>
<tr><td>f</td></tr>
</table>
</div>
I have dialog with html :
<div id="sample">
<div class="sample-wraper">
<a class="modal_close" href="#"></a>
<form id="Form1" name="Form1" method="post">
<table id="tt">
<tr align="center">
<td colspan="2" id="naam"><b>Cha test</b></td>
</tr>
<tr>
<td colspan="2">
<div id="boodschap" class="text" style="border-right: 1px solid; border-top: 1px solid; overflow: auto;
border-left: 1px solid; width: 468px; height: 182px; border-bottom: 1px solid;
background-color: white">njnknkkm</div>
</td>
</tr>
<tr>
<td colspan="2">
<textarea id="antwoord" name="antwoord" class="text"
style="width: 465px; height: 182px; border-width: 1px; border-style: solid; border-color: black;"
onkeydown="textCounter(antwoord,aantal,1000)"
onkeyup="textCounter(antwoord,aantal,1000)"></textarea>
</td>
</tr>
<tr>
<td class="text" align="left" width="210">
Caráters permitidas
<input readonly type="text" name="aantal" size="3" maxlength="4" value="1000" id="aantal"></td>
<td align="right">
<input id="Submit" name="Submit" type="button" value="Enviar" onclick="submitForm();"
class="button" style="width: 130px">
</td>
</tr>
</table>
<input id="IdTo" name="IdTo" type="hidden">
</form>
</div>
and css like this :
#sample {
background: none repeat scroll 0 0 #FFFFFF;
border-radius: 5px;
box-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
border: 1px solid;
display: none;
padding: 15px 10px 10px;
position:absolute !important;
}
.modal_close {
background: url("Close-icon-download-182005456677-png/button.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0);
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='Close-icon-download-182005456677-png/button.png',sizingMethod='scale');
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='Close-icon-download-182005456677-png/button.png',sizingMethod='scale')";
display: block;
height: 20px;
position: absolute;
right: 10px;
top: 10px;
width: 20px;
z-index: 2;
}
Problem is that in IE8 on this dialog in top-left corner i get some square, which disappears if i remove border from dialog (#sample).
http://clip2net.com/s/i6klpi (sample of problem)
In IE7 and IE9 i didn't get this "feature" in corner.
I found this post about problem with IE borders http://www.brasee.com/displayPost.htm?postId=64. As my dialog is with position absolute (this is for not moving dialog when scrolls) i add wrapper of this dialog. So i set for dialog position relative and for wrapper position absolute. But this also didn't help. Get this result: clip2net.com/s/i6lcKz