Is it possible to justify a text to a diagonel line in CSS/HTML?
And if yes, how, can you share some more keywords to search, or specify a path?
Like this:
Is it possible to justify a text to a diagonel line in CSS/HTML?
And if yes, how, can you share some more keywords to search, or specify a path?
Like this:
Here is an example fiddle: http://jsfiddle.net/JrM3x/
var cssmargin = 10;
$('div').each(function(){
$(this).css("margin-left", cssmargin+"px");
cssmargin += 10;
});
<div>
<div>hello world</div>
<div>how are you today?</div>
<div>I'm good thanks</div>
</div>
You can of course specify a class on each div that needs to be "staircased" and use each on that instead.
NOTE: This is obviously not a pure html css solution. You could do it that way but it would not be scalable at all. This solution also requires use of jQuery
A pure html/css solution can be done like this, but it's not pretty.
#one{ margin-left:10px;}
#two{margin-left:20px;}
#three{margin-left:30px;}
<div>
<div id="one">hello world</div>
<div id="two">how are you today?</div>
<div id="three">I'm good thanks</div>
</div>
<style>
div {margin-left:10px;}
div+div {margin-left:20px;}
div+div+div{margin-left:30px;}
div+div+div+div{margin-left:40px;}
</style>
<div>Lorem Ipsum is simply dummy text of the printing and </div><br>
<div>typesetting industry. Lorem Ipsum has been the industry's </div> <br>
<div>standard dummy text ever since the 1500s, when an unknown </div><br>
<div>printer took a galley of type and scrambled it to make a type </div>
This seems to be the closest one. I have used css3's transform skew property.
body>div {
-webkit-transform: skewX(30deg);
margin-left: 50px;
margin-top: 50px;
font-style: italic;
}
Play with "scale", "skew" and "rotate" of transform
css3 property. you may get your result. :)
Keep nested elements in list items as shown below:
<ul>
<li>this is first line
<ul>
<li>this is second line
<ul>
<li>this is third line</li>
</ul>
</li>
</ul>
</li>
</ul>
You can also do the above trick with simple nested div elements by giving some fixed margin-left or padding-left.