I've a html where i want a particular cell to be aligned to left. below is the code and fiddle link.
HTML:
<section class="tr_chapter">
<div class="chapter"><a name="HKWBV1_ORD_89"></a>
<div class="toc">
<div class="toc-part">
<table class="toc-div">
<tbody>
<tr>
<td>
<table class="toc-item-third-level">
<tbody>
<tr>
<td></td>
<td class="toc-item-num-left"><span class="font-style-bold">Contents</span></td>
<td class="toc-title"></td>
<td class="toc-pg"><span class="font-style-italic">para.</span></td>
</tr>
<tr>
<td>4/0/1</td> <td class="toc-item-num-left">1.</td>
<td class="toc-title">Companies (O.4, r.2)</td>
<td class="toc-pg">4/2</td>
</tr>
<tr>
<td></td>
<td class="toc-item-num-left">2.</td>
<td class="toc-title">Consolidation, etc., of causes or matters (O.4, r.9)</td>
<td class="toc-pg">4/9</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</section>
I want the output as given in the below image. i.e. the number (4/0/1). please let me know how can i do it.
Fiddle
Thanks
If you want the cell with the number 4/0/1 aligned left simply give align="left" to the parent td or add to it a class with text-align:left;
See: jsfiddle
Related
I am creating one leave template,In which I am using bootstrap for responsiveness.But Its occupying more space between label and colon
Here is my code.how can I reduce the space between label and colonhttps://jsfiddle.net/zewykeLm/I want like this,If there any other good way please suggest me
Try this. Using table and ::before selector.
<!DOCTYPE html>
<html lang="en">
<head>
<style>
table tbody tr td:nth-child(2)::before {
content: " :";
}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<td>Employee name</td>
<td>bnhvg</td>
</tr>
<tr>
<td>Requested Leave from</td>
<td>bnhvg</td>
</tr>
<tr>
<td>Requested Leave from</td>
<td>bnhvg</td>
</tr>
<tr>
<td>Total Time requested</td>
<td>bnhvg</td>
</tr>
<tr>
<td>Leave Type</td>
<td>bnhvg</td>
</tr>
</tbody>
</table>
</body>
</html>
Correct your code errors by replacing this
<div class="container">
<section class="col-lg-10 col-md-10 col-sm-10 col-xs-10" style="margin-top:4%;">
<div style="text-align: right;"><label>Date:</label> <span>#sentDate#</span></div>
<table>
<tbody>
<tr>
<td><label>Employee name</label></td>
<td>#empName#</td>
</tr>
<tr>
<td><label>Employee Id</label></td>
<td>#empId#</td>
</tr>
<tr>
<td><label>Requested Leave from</label></td>
<td>#levFrom#</td>
</tr>
<tr>
<td><label>Requested Leave To</label></td>
<td>#levTo#</td>
</tr>
<tr>
<td><label>Total Time requested</label></td>
<td>#totalTime#</td>
</tr>
<tr>
<td><label>Leave Type</label></td>
<td>#levType#</td>
</tr>
</tbody>
</table>
<div><label>Special notes:</label></div>
<div style="margin: 20px 0 20px 0;">
#I have given propernotice to all pertinent parties that I will be out of the office for the period of time listed above and have made arrangements for coverage of all my office responsibilites.#
</div>
<div style="text-align: left;"><label> Regards</label></div>
<table>
<tbody>
<tr>
<td><label>Name</label></td>
<td>#name#</td>
</tr>
<tr>
<td><label>Mobile Number</label></td>
<td>#mobNum#</td>
</tr>
</tbody>
</table>
</section>
</div>
I don't think I understand Bootstrap logic quiet well. With code listed down, I defined table-responsive class with 12 units. For each cell within table i then used defined the size.
So basic idea is to get this:
0
1 2 3
However bootstrap returns me this:
_0_
_1_2 3
For the value 1 it takes the parameters of cell with value 0. Why is that, eventhose i defined cell nr.1 can have only one unit size. Please let me know. Thank you.
<div class="table-responsive col-xs-12">
<table class="table">
<tbody>
<tr>
<td class="col-xs-3" style="text-align:center;">0</td>
</tr>
<tr>
<td class="col-xs-1" style="text-align:center;">1</td>
<td class="col-xs-1" style="text-align:center;">2</td>
<td class="col-xs-1" style="text-align:center;">3</td>
</tr>
</tbody>
</table>
</div>
<div class="table-responsive col-xs-12">
<table class="table">
<tbody>
<tr>
<td class="col-xs-3" colspan="3" style="text-align:center;">0</td>
</tr>
<tr>
<td class="col-xs-1" style="text-align:center;">1</td>
<td class="col-xs-1" style="text-align:center;">2</td>
<td class="col-xs-1" style="text-align:center;">3</td>
</tr>
</tbody>
</table>
</div>
you need to alter your first row like this. You are getting this error because the column structure for each row would be same.
<tr>
<td></td>
<td class="col-xs-1" style="text-align:center;">0</td>
</tr>
Here is a pen and below is a working example:
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="table-responsive col-xs-12">
<table class="table">
<tbody>
<tr>
<td></td>
<td class="col-xs-1 col-offset-3" style="text-align:center;">0</td>
</tr>
<tr>
<td class="col-xs-1" style="text-align:center;">1</td>
<td class="col-xs-1" style="text-align:center;">2</td>
<td class="col-xs-1" style="text-align:center;">3</td>
</tr>
</tbody>
</table>
</div>
There is a simple way to do this, i have copied your code and add display:inline-block to td element try with the snippet
table tr {
text-align:center;
}
table tr td {
display:inline-block !important;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="table-responsive col-xs-12">
<table class="table">
<tbody>
<tr>
<td class="col-xs-1" style="text-align:center;">0</td>
</tr>
<tr>
<td class="col-xs-1" style="text-align:center;">1</td>
<td class="col-xs-1" style="text-align:center;">2</td>
<td class="col-xs-1" style="text-align:center;">3</td>
</tr>
</tbody>
</table>
</div>
I've created a website here and in the Kontakt section I added opening hours but I couldn't figure out how to code it for the days to align nicely and the other information also.
so I just put a PNG there to simulate the look I was looking for.
Nevertheless I would like to know how to code it properly because when I view it on a bigger screen or on a tablet device it messes with the bracket it's in because it isn't even with the bracket next to it.
The following code is the code from the left bracket where the text is, and it's working perfectly but I don't know how to code opening hours correctly.
<section id="blog-area">
<div class="container">
<div class="row text-center inner">
<div class="col-sm-6">
<div class="blog-content"><br><br>
<h2 class="feature-content-title green-text">+ 421 903 977 345</h2>
<p><strong>Iľja Takács</strong><br><br>
iljatakacs#gmail.com<br>
facebook #lakovnaturen<br><br>
Tureň 390, 903 01 Senec | Areál bývalého PD Tureň</p><br>
</div>
</div>
Link to the png image: http://testinglakovna.borec.cz/img/otvaraciehodiny.png
I suggest that you make a table. This way you can define every width to the pixel and make sure everything is aligned the way you displayed on the website.
I made a simple JSFiddle hope that helps.
<table class="tg">
<tr>
<td class="day">Po</td>
<td class="time">09.00</td>
<td class="sign">-</td>
<td class="time">20.00</td>
</tr>
<tr>
<td class="day">Ut</td>
<td class="time">09.00</td>
<td class="sign">-</td>
<td class="time">20.00</td>
</tr>
<tr>
<td class="day">St</td>
<td class="time">09.00</td>
<td class="sign">-</td>
<td class="time">20.00</td>
</tr>
<tr>
<td class="day">St</td>
<td class="time">09.00</td>
<td class="sign">-</td>
<td class="time">20.00</td>
</tr>
<tr>
<td class="day">Pia</td>
<td class="time">09.00</td>
<td class="sign">-</td>
<td class="time">20.00</td>
</tr>
<tr>
<td class="day">So</td>
<td class="time">09.00</td>
<td class="sign">-</td>
<td class="time">20.00</td>
</tr>
<tr>
<td class="day">Ne</td>
<td class="extra" colspan="3">Na objednavku</td>
</tr>
</table>
Jsfiddle
I am using Ink to try and create an order confirmation e-mail from an ecommerce store. If I have a table that shows item info or any sort of data I layout, the last column is crunched to one character width when resizing to small. Example code in a 6-column cell is attached for code as well as the output screenshot.
Any ideas how I can fix this?
<table class="six columns">
<tr>
<td>
<table width="100%">
<tr>
<td>Subtotal</td>
<td>$60.00</td>
</tr>
<tr>
<td>Shipping & Handling</td>
<td>$11.91</td>
</tr>
<tr>
<td><strong>Grand Total</strong></td>
<td><strong>$71.91</strong></td>
</tr>
</table>
</td>
<td class="expander"></td>
</tr>
</table>
A Ink sub-grid would be useful here.
HTML
<table class="body">
<tr>
<td class="center" align="center" valign="top">
<div class="c1">
<table class="row">
<tr>
<td class="wrapper">
<table class="twelve columns">
<tr>
<td class="ten sub-columns">Subtotal</td>
<td class="two sub-columns last">$10</td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
<table class="row">
<tr>
<td class="wrapper">
<table class="twelve columns">
<tr>
<td class="ten sub-columns">S&H</td>
<td class="two sub-columns last">$2</td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
<table class="row">
<tr>
<td class="wrapper">
<table class="twelve columns">
<tr>
<td class="ten sub-columns">Total</td>
<td class="two sub-columns last">$12</td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
Screenshot
Here's the demo.
I think Ink is only for creating responsive e-mail layouts. If you want something more, you can use standard HTML. So <table> with <tr>, <td> and <th>.
I have a masterpage in which their is a table with 3 rows.
The first row is for header 2nd for body and 3rd for footer.
The header row again contains a table with 1 row and 3 columns.
the first col width is fixed to 238 px while the last col is fixed as 7% width. and the middle col occupies all left space.
the second row also contains 3 cols with 1st col = 20% and 3rd col = 20% and middle occupies the rest.
The problem:- I have to aling the the middle col of both the table in a way that inner content start from same horizontal position.
here is a sample of the html with the required style
<html xmlns="http://www.w3.org/1999/xhtml">
.style1
{
width: 100%;
}
<div align="center">
<table align="center" class="style1">
<tr>
<td>
<div align="center">
<table align="center" class="style1">
<tr>
<td width="238px">
Logo width = 238px</td>
<td align="center">
<div style="background-color: #008000">
start line should aling with the below start line</div>
</td>
<td width="7%">
cart width =7%</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<table align="center" class="style1">
<tr>
<td width="20%">
</td>
<td align="center">
start line should aling with the top</td>
<td width="20%">
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
I need to aling 'start line'(in div with bgcolor = green and in td ) so that they start from the same position.
<div align="center">
<table align="center" class="style1">
<tr>
<td>
<div align="center">
<table align="center" class="style1">
<tr>
<td width="238px">
Logo width = 238px</td>
<td style="padding-left:50px; background-color: #008000">
start line should aling with the below start line
</td>
<td width="7%">
cart width =7%</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<table align="center" class="style1">
<tr>
<td width="238px">
</td>
<td style="padding-left:50px;">
start line should aling with the top</td>
<td width="20%">
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
use padding instead of align="center"
Width of the first <td> in the second table should also be 238px.
<td width="238px"> </td>
Edit: Do you have style1 defined in a <style> tag? The second <tbody> will have reduced width if not.
<style type="text/css">.style1 { width: 100%; } </style>