How would you align text like this without tables?
<table>
<tr>
<td>*</td>
<td>Long Text</td>
</tr>
<tr>
<td>*</td>
<td>Long Text</td>
</tr>
</table>
How would you align text like this without tables?
<table>
<tr>
<td>*</td>
<td>Long Text</td>
</tr>
<tr>
<td>*</td>
<td>Long Text</td>
</tr>
</table>
use display:inline-block
property
<div class="a">
<p class="p1">*</p>
<p class="p2">kjwhkwgkufygajkfgxaskjfgkj hsgdfjkagsdkufygukasygfkjsghadfjkghfjkahgxf jasghdfkjaghxfkjkjasghfuhxg kjasdgh</p>
</div>
<div class="a">
<p class="p1">*</p>
<p class="p2">kjwhkwgkufygajkfgxaskjfgkj hsgdfjkagsdkufygukasygfkjsghadfjkghfjkahgxf jasghdfkjaghxfkjkjasghfuhxg kjasdgh</p>
</div>
css
.p1{
width:2%;
display:inline-block;
vertical-align:top;
}
.p2{
width:80%;
display:inline-block;
vertical-align:top;
}
.a{
width:600px;
}
You can do this with floating divs.
<div>
<div class="leftDiv">*</div>
<div class="rightDiv">Long Text</div>
<div class="leftDiv">*</div>
<div class="rightDiv">Long Text</div>
</div>
and then float them next to each other in the CSS
.leftDiv
{
clear:both;
width:5%;
float:left;
}
.rightDiv
{
width:95%;
float:left;
}
In the end, I used a somewhat complex solution:
http://jsfiddle.net/4xq55vg6/10/
p
{
margin-left: 1.5em;
display: block;
}
p:before
{
content: "*";
margin-left: -1em;
display: inline-block;
position: absolute;
}
Maybe something like this
td{
text-align:center;
}
you can use right center left justify values for text-align
Like this:
<div style="width:100%;text-align:center">Hello</div>
Of course you shouldn't use inline-styles. Better:
<div class="aClass">Hello</div>
.aClass{text-align:center;width:100%;}
ul {
list-style: none;
margin-left: 0;
padding-left: 1em;
text-indent: -1em;
}
<ul>
<li>* This is a ... ng it?</li>
<li>* And here is an ... way of doing it?</li>
</ul>
Looking at the fiddle you can keep those lines in <p>
tag and in CSS add a content: "*"
before
HTML
<p>This is a long text... </p>
<p>And here is another text....</p>
CSS
p:before { content: "*"}