I have a table and i want 2 tds centered like
** Hello | World ** without adding empty tds before and after ?
I have something like this which works fine but i dont want to add extra tds and do it the same way
<table class="alignCenter" style="border:1px solid black">
<tr>
<td>
</td>
<td class="searchField">
<select id ="exactField">
<option value="default">Request num</option>
</select>
<input type="text" class="textBox" id="exactValue"/>
</td>
<td class="tableButtons">
<button type="button" class="clear" ><bdi>${Clear_Button}</bdi></button>
<button type="button" class="submit" ><bdi>${Search_Button}</bdi></button>
</td>
<td>
</td>
</tr>
</table>
CSS
table,.alignCenter {
width: 1000px;
margin: 0px auto;
text-align: left;
table-layout: fixed;
font-size: 0.9em;
}
table tr td,.alignCenter tr td {
overflow: hidden;
border: 1px solid black;
vertical-align: top;
padding: 5px 2px 5px 2px;
}
.alignCenter tr td {
text-align : center;
}
.tableButtons {
width:250px;
}
.searchField {
width:300px;
}
Fiddle
Why you even need 4 td's to accomplish something like that?
Just use a single td (I would use a simple div for this)
Demo
<table class="alignCenter" style="border:1px solid black">
<tr>
<td>
<select id ="exactField">
<option value="default">Request num</option>
</select>
<input type="text" class="textBox" id="exactValue"/>
<button type="button" class="clear" ><bdi>${Clear_Button}</bdi></button>
<button type="button" class="submit" ><bdi>${Search_Button}</bdi></button>
</td>
</tr>
</table>
would something like this work?
html..
<table style="border:1px solid black">
<tr>
<td class="alignright" >
<select id ="exactField">
<option value="default">Request num</option>
</select>
<input type="text" class="textBox" id="exactValue"/></td>
<td class="alignleft" >
<button type="button" class="clear" ><bdi>${Clear_Button}</bdi></button>
<button type="button" class="submit" ><bdi>${Search_Button}</bdi></button>
</td>
</tr>
</table>
css..
table,.alignright {
width: auto;
margin: 0px auto;
text-align: right;
table-layout: fixed;
font-size: 0.9em;
}
table,.alignleft {
width: auto;
margin: 0px auto;
text-align: left;
table-layout: fixed;
font-size: 0.9em;
}
.tableButtons {
width:250px;
}
.searchField {
width:300px;
}
FIDDLE
Related
I am using JavaMail API for sending mail. In my mail, I have to attach HTML content.
I am using the following code to prepare HTML.
<html>
<head>
<style>
input[type=text],
select,
textarea {
padding: 12px 30px;
margin: px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
background-color: white;
color: black;
font-size: 75%;
}
input[type=text],
select .longText {
width: 100%;
}
textarea.longText {}
.processDetails {
background-color: #f2f2f2;
width: 80%;
}
div {
border-radius: 5px;
padding: 20px;
}
textarea#description {
margin-left: 4%;
}
.center {
margin: auto;
width: 50%;
box-sizing: border-box;
border-radius: 4px;
padding: 0;
text-align: center;
margin-top: 6px;
}
label {
margin-left: 5%;
color: blue
}
#centerBody {
margin: auto;
width: 100%;
box-sizing: border-box;
border-radius: 4px;
padding: 0;
text-align: center;
margin-top: 6px;
}
</style>
</head>
<body>
<div class="processDetails">
<div class="center">
<table>
<tr>
<td width="40%">
<label for="process"> Name</label>
</td>
<td width="60%">
<input type="text" class="longText" value=DSDS disabled>
</td>
</tr>
</table>
</div>
<div class="centerBody">
<table id="processTable">
<tr>
<td width="20%">
<label for="processProperties">Code</label>
</td>
<td width="28%">
<input type="text" value=TAWELC disabled>
</td>
<td width="20%">
<label for="processProperties">City</label>
</td>
<td width="28%">
<input type="text" value=Lucknow disabled>
</td>
</tr>
<tr>
<td width="20%">
<label for="processProperties">Organisation</label>
</td>
<td width="28%">
<input type="text" value=HR disabled>
</td>
<td width="20%">
<label for="processProperties">Email</label>
</td>
<td width="28%">
<input type="text" value=vishal.something#gmail.com disabled>
</td>
</tr>
</table>
<table>
<tr>
<td width="19%">
<label for="description">Adress</label>
</td>
<td width=68%>
<textarea class="longText" cols=65% style="height:50px;margin-left: 5%;resize: none; position: fixed;" disabled>asd</textarea>
</td>
<td width=24%></td>
</tr>
</table>
</div>
</div>
</body>
</html>
When I sent this as a mail body, I found that the behavior of the HTML content is not the same in Browser and Outlook Applications.
I can see text area alignment differences when I open mail in the Microsoft outlook application.
Please let me know what is wrong here or how can I fix the issue.
Regards,
Vishal
I have a weird question, and perhaps it's more suitable for the CSS fans out there, but why would content inside an absolute positioned div overflow out past everything else?
The example provided here (as a picture) shows that the content overflows out the blue bordered div. The content inside this box should rightfully define the the div's height no? How can this be remedied so that my 'blue' box fits to its content?
Here's the markup in question:
* {
box-sizing: border-box;
font-family: Verdana, Arial, sans-serif;
font-size: 9pt;
}
html {
height: 100%;
}
body {
margin: 0;
padding: 0;
height: 100%;
background: rgb(105, 105, 105);
}
#table-container {
display: table;
text-align: center;
width: 100%;
height: 100%;
}
#container {
display: table-cell;
vertical-align: middle;
}
#wrapper {
padding: 25px;
}
.tabs {
position: relative;
margin: 40px 0 25px;
}
.tab {
float: left;
}
.tab label {
background: rgb(105, 105, 105);
padding: 10px;
border: 1px solid transparent;
color: #FFF;
margin-left: -1px;
position: relative;
left: 1px;
top: -26px;
}
.tab label:hover {
background: #000;
}
.tab [type=radio] {
display: none;
}
.content {
position: absolute;
top: -1px;
left: 0;
background: rgb(222, 222, 222);
right: 0;
bottom: 0;
padding: 20px;
border: 1px solid transparent;
opacity: 0;
color: rgb(58, 58, 58);
}
[type=radio]:checked~label {
background: rgb(222, 222, 222);
font-weight: bold;
border-bottom: 1px solid transparent;
color: #000;
z-index: 2;
}
[type=radio]:checked~label~.content {
z-index: 1;
opacity: 1;
}
/* CSS for Table and Field styling */
.table {
width: 100%;
padding: 0;
margin: 0;
text-align: left;
}
.table td {
border: 1px solid #000;
}
.inputbox {
border: 1px solid rgb(170, 170, 170);
width: 100%;
}
.inputbox:hover {
border: 1px solid rgb(109, 109, 109);
}
.input {
border-style: none;
border-color: inherit;
border-width: 0;
padding: 3px;
height: 20px;
}
input[type="text"],
textarea {
width: 100%;
box-sizing: border-box;
}
.input:focus {
background: rgb(255, 255, 196);
}
<div id="table-container">
<div id="container">
<div id="wrapper">
<div style="border: 1px solid red; text-align: left; font-size: 8pt; color: #fff;">Choose language/Choisissez langue:</div>
<div style="border: 1px solid blue; height: 100%;">
<div class="tabs">
<!-- TAB [1] -->
<div class="tab">
<input type="radio" id="tab-1" name="tab-group-1" checked><label for="tab-1">English</label>
<div class="content">
<table class="table">
<tr>
<td>Traveller's Name:</td>
<td colspan="2">
<div class="inputbox"><input type="text" id="tname" class="input" name="Name of Traveler" tabindex="1" /></div>
</td>
<td style="width: 15%;"></td>
<td>Tan #:</td>
<td></td>
</tr>
<tr>
<td>Destination:</td>
<td colspan="2">
<div class="inputbox"><input type="text" id="location" class="input" name="Location" tabindex="2" /></div>
</td>
<td></td>
<td>Status:</td>
<td></td>
</tr>
<tr>
<td>iTravel Trip Number:</td>
<td colspan="2">
<div class="inputbox"><input type="text" id="location" class="input" name="Location" tabindex="2" /></div>
</td>
<td></td>
<td>Date Issued:</td>
<td>
<div class="inputbox"><input type="text" id="dissued" class="input" disabled/></div>
</td>
</tr>
<tr>
<td>Event Plan ID Code:</td>
<td colspan="2">
<div class="inputbox"><input type="text" id="evt-plan-code" class="input" name="Event Plan ID Code" tabindex="4" /></div>
</td>
<td></td>
<td>Issued by:</td>
<td>
<div class="inputbox"><input type="text" id="issuer" class="input" disabled/></div>
</td>
</tr>
<tr>
<td>Dates of Travel</td>
<td>From:</td>
<td>
<div id="ddate" name="Departure Date" tabindex="5"></div>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td> </td>
<td>To:</td>
<td>
<div id="rdate" name="Return Date" tabindex="6"></div>
</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Trip Purpose</td>
<td colspan="3"></td>
<td></td>
<td></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
</div>
<div class="tab">
<input type="radio" id="tab-2" name="tab-group-1"><label for="tab-2">Français</label>
<div class="content">
tab2
</div>
</div>
</div>
</div>
<div style="border: 1px solid green; text-align: left;">
<input type="button" value="Issue TAN" id="issue">
<input type="button" value="Reset form" id="issue">
<input type="button" value="Save changes" id="issue">
</div>
</div>
<!-- end of div #wrapper -->
</div>
<!-- end of div #container -->
</div>
<!-- end of div #table-container -->
The absolute-positioned div doesn't affect the container div's size since setting position to absolute removes it from the document flow. It's essentially the same behaviour as when position is set to fixed, except it stays at the same place in the page when you scroll. More info can be found here and here.
As for how to fix the height of your div, the short answer is that it can't be done with CSS unless you use a different value for position, perhaps relative in your case but that will depend on the structure of your html. This question covers some other ways that you could go about it.
I want to centre align a number of tables next to each other at the top in the middle of a div. Underneath these tables I want to have a list of vertical buttons left aligned. I have tried many different techniques but none of which seem to work. Please could someone help?
Current Fiddle Example:
https://jsfiddle.net/Jaron787/gg30jgh5/
CSS
.TSS {
font-family: Verdana, Geneva, sans-serif;
font-size: 10.6px;
font-style: normal;
text-decoration: none;
float: left;
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
border: 1px solid black;
}
.button {
background-color: #4CAF50;
/* Green */
border: none;
color: white;
padding: 5px 15px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
-webkit-transition-duration: 0.4s;
/* Safari */
transition-duration: 0.4s;
cursor: pointer;
}
.button1 {
background-color: white;
color: black;
border: 2px solid #4CAF50;
}
.button1:hover {
background-color: #4CAF50;
color: white;
}
HTML
<div id="lse" class="display">
<table id="tblData" class="TSS">
<tr>
<td align="center" colspan="4"><b>Table 1</b></td>
</tr>
</table>
<table id="tblData" class="TSS">
<tr>
<td align="center" colspan="4"><b>Table 2</b></td>
</tr>
</table>
<input type="submit" class="button button1" name="submitButton" value="Button 1">
<input type="submit" class="button button1" name="submitButton" value="Button 2">
<input type="submit" class="button button1" name="submitButton" value="Button 3">
<input type="submit" class="button button1" name="submitButton" value="Button 4">
</div>
Probably just create a wrapper around the tables.
<div id="centertbl">
<table id="tblData" class="TSS">
<tr>
<td align="center" colspan="4"><b>Table 1</b></td>
</tr>
</table>
<table id="tblData" class="TSS">
<tr>
<td align="center" colspan="4"><b>Table 2</b></td>
</tr>
</table>
Then apply the text-align to center.
#centertbl { text-align: center;}
That will center the tables in middle. Removed the margin: 0 auto; from the class .TSS.
Change the button css code from display: inline-block; to display: block;
jsFiddle : https://jsfiddle.net/gg30jgh5/6/
I think you need this type of css:
please check updeted fiddle link:
some changes in your html structure.table is one div and button is another sepreate div.
https://jsfiddle.net/gg30jgh5/9/
Set both tables inside a div and set margin-left:50% for this div
Set all buttons inside a div and set clear:both for this div.
I have this HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<script type='text/javascript' src='js/jquery-1.10.2.min.js'></script>
<script type='text/javascript' src='js/knockout-3.0.0.js'></script>
<script type='text/javascript' src='js/myTasks.js'></script>
<link rel="stylesheet" type="text/css" href="css/walk.css">
<TITLE>Your Tasks</TITLE>
</HEAD>
<BODY>
<div class="screenSection">
<div class="sectionHeader">
<p>Your Tasks</p>
</div>
<div class="lines">
<table class="dataTable" id="CADataTable">
<thead>
<tr>
<th style="width: 15em;"> Project name</th>
<th style="width: 7em;"> Number</th>
<th style="width: 50em;"> description</th>
<th style="width: 5em;"></th>
</tr>
</thead>
<tbody data-bind="foreach: Assimilation">
<tr>
<td><input type="text" name="Name" id="Name" data-bind="value: Name" style="width: 15em;"></td>
<td><input type="text" name="Num" data-bind="value: Num" style="width: 7em;"></td>
<td><input type="text" name="Desc" data-bind="value: Desc" style="width: 50em;"></td>
<td style="width: 5em;">
<img src="img/close.jpg" alt="Close" data-bind="click: $root.removeAssimilation">
</td>
</tr>
</tbody>
</table>
<button type="button" id="export" class="button" data-bind="click: newAssimilation">Add new row</button>
</div>
</div>
</BODY>
</HTML>
Now everything is ok, but when I press the add new row button, I'm getting this ugly thing:
I'm using this css:
#CHARSET "UTF-8";
.formElement { height: auto; margin: 0 0.4em; padding: 0 0 0.5em 0.5em; min-width: 40%; display: inline-block;}
.formElement label {
display: block;
font-size: 1.7em;
margin: 0.8em 0 0.1em 0.15em;
width: 17.89em;
}
.formElement textarea { border: 1px solid #CCCCCC; padding: 2px; font-size: 1.15em; }
.formElement span { font-size: 1.05em; font-weight: bold; }
.lines { overflow: hidden; }
#commentInformation .formElement { width: 80%; }
input[type="text"] { border: 1px solid #CCCCCC; padding: 0.2em; height: 22px; width: 250px }
fileSelection { width: 50em; height: 30px; }
input:focus,textarea:focus,select:focus{
-webkit-box-shadow:0 0 6px #007eff;
-moz-box-shadow:0 0 5px #007eff;
box-shadow:0 0 5px #007eff; outline: none; }
td
{
background: #A9D0F5;
text-align: center;
height:2em;
}
th
{
height:2em;
}
.trClass
{
height:2em;
white-space: nowrap;
}
table
{
width: 98%;
font-size: 1.2em;
clear: both;
}
What I'm trying to do is to remove the blue space.
I'm 1000% sure that I'm making a small mistake somewhere, but it is my first css try. I'm a backend developer and it is really hard for me to spot any non sense things in the code. Please help me!
EDIT:
JSFIDDLE
Try this fiddle http://jsfiddle.net/37sbw/5/
you need to remove the
background: #A9D0F5;
applied for td
keep it like this
td
{
//background: #A9D0F5;
text-align: center;
height:2em;
}
I have even added
cellspacing="0px"
to the table to remove the spacing between the cells.
If cellspacing is not applied then go for this
table
{
border-spacing:0px;
}
Make Cell Spacing & Cell Padding as 0px
I am guessing you mean that the input field doesn't take up all the parent's width.
You have specified inline-style. This will override the CSS you've put in a seperate sheet.
<td><input type="text" name="Name" id="Name" data-bind="value: Name" style="width: 15em;"></td>
<td><input type="text" name="Num" data-bind="value: Num" style="width: 7em;"></td>
<td><input type="text" name="Desc" data-bind="value: Desc" style="width: 50em;"></td>
<td style="width: 5em;">
<img src="img/close.jpg" alt="Close" data-bind="click: $root.removeAssimilation">
</td>
Get rid of all the occurences of style="" and it should work as you expect it to work.
Additionally, change your CSS to this:
input[type="text"] {width: 100%;}
Set border-spacing of your table to 0:
table {
width: 98%;
font-size: 1.2em;
clear: both;
border-spacing: 0;
}
This will get rid of your white space between the cells.
jsFiddle
I am creating a table. I want to remove table border line, how do I this?
Here is my code:
<div id="table">
<table class="table table-bordered">
<thead>
<tr>
<th style="text-align:left; width:120px;">Item</th>
<th style="text-align:left; width:200px;">Description</th>
<th style="width:100px;">Unit Cost</th>
<th style="text-align:right; width:60px;">Qty</th>
<th style="text-align:left; width:100px;">Tax</th>
<th style="text-align:left; width:100px;">Tax</th>
<th style="text-align:left; width:100px;">Line Total</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan=7 width=800>
<div id="dataRows">
<div class="fieldRow" id="template">
<select class="items" name="items" style="width:127px; float:left;" id="items"> <option value="1" selected="selected" disabled="disabled"></option></select>
<textarea name="description" id="description" class="description" style="float:left; display: block; height: 30px; width:211px; border-radius:0px; margin: -1px 0px 0;"></textarea>
<input type="text" name="unitprice" id="unitprice" class="unitprice" style="float:left; display: block; height: 30px; width:106px; border-radius:0px; margin: -1px 0px 0;">
<input type="text" name="quantity" id="quantity" class="quantity" style="float:left; display: block; height: 30px; width:64px; border-radius:0px; margin: -1px 0px 0;">
<select name="firsttax" id="firsttax" class="firsttax" style=" float:left; display: block; height: 31px; width:107px; border-radius:0px; margin: -2px 0px 0;"><option value="1" selected="selected" ></option></select>
<select name="secondtax" id="secondtax" class="secondtax" style="float:left; display: block; height: 31px; width:104px; border-radius:0px; margin: -2px 0px 0;"><option value="1" selected="selected"></option></select>
<input type="text" name="linetotal" id="linetotal" class="linetotal" placeholder="0.00" readonly style="float:left; display: block; height: 31px; width:104px; border-radius:0px; background-color: #F0F0F0; text-align:right; margin: -2px 0px 0;">
<input type="button" class="button remove" id="btnDel" value="Remove Row" style="float:right; margin:0 -110px; color: #ffffff; background-color: #d9534f; border-color: #d43f3a; padding: 3px 10px; margin-bottom: 0; font-size: 14px; font-weight: normal; line-height: 1.428571429; text-align: center; white-space: nowrap; vertical-align: middle; cursor: pointer; border:1px solid transparent; border-radius: 4px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none;" />
</div>
</div>
</td>
</tr>
<input type="hidden" id="itemscounter" name="itemscounter" value=""/>
<tr>
<td colspan=7 rowspan=2 width=800 style="border:0px solid white;">
<div style="border:1px solid #DDDDDD; width:317px; height:50px; margin:0 -1px; float:right;">
<label class="required" id="invoicetotal" for="Invoicetotal" style="padding-top:3px;">Invoice Total(USD)</label>
<span style=" font-weight:bold; margin:4px -204px 0; float:right;">$</span>
<input type="text" class="required" id="invoicetotalamount" name="invoicetotalamount" placeholder="0.00" readonly style=" color:#526273; font-weight:bold; text-align:left; border: 0px solid #000000;"/><br>
<label class="required" id="paidtodate" for="paidtodate" style="margin-top: -6px;">Paid to date</label>
<input type="text" class="required" id="paidtodateamount" name="paidtodateamount" placeholder="0.00" style=" color:#526273; font-weight:bold; text-align:right; border: 0px solid #000000;"/>
</div>
<div class="clear"></div>
<div style="border:1px solid #DDDDDD; width:317px; height:33px; margin:50px -316px 0; float:right;">
<label class="required" id="balance" for="balance" style="margin-top:0px;">Balance(USD)</label>
<span style=" font-weight:bold; margin:7px 45px 0; float:left;">$</span>
<input type="text" class="required" id="balanceamount" name="balanceamount" placeholder="0.00" readonly style=" color:#526273; font-weight:bold; text-align:left; border: 0px solid #000000;"/>
</div>
</td>
</tr>
</tbody>
</table>
</div>
and here is my css:
#table{
float: left;
height: 200px;
margin: -291px 19px 0;
width: 825px;
}
and here is screenshot:
use css
it would be
table, th, td
{
border: 0;
}
table
{
border-collapse:collapse;
}
<table border="0" style="width:825px;"> </table>
put border value 0 in css or declare table border like these above i mentioned.. post ur full css code..
Try to use this code:
<table border="0" style="width:825px;border:0px;"> </table>
Try this simple CSS
table.myTable { border:none; }
edit your class and add/change border to zero or try changing into border tag in table.