Issue
Can anyone suggest a better way of using dividers one shorter and one longer 2px solid at the center of page after a section or paragraph. I do not want to repeat myself using like the following
<section>
<article>
<p>texttext text </p>
<div id="divider">
<div id="divider-short"> </div>
<div id="divider-long"> </div>
</div>
</article>
</section>
#divider{
float:right;
margin-right:35%
direction:rtl;
}
#divider-short{
width:150px;
border:2px solid gray;
margin-top:30px;
clear:both;
}
#divider-long{
margin-top:10px;
width:300px;
border:2px solid gray;
clear:both;
}
Solution
you can create one common divider class and add it where you want divider.
.divider{
padding-bottom:25px;
position:relative;
}
.divider:before,.divider:after{
width:300px;
height:2px;
background-color:red;
display:inline-block;
content:"";
position:absolute;
bottom:8px;
margin-left:auto;
margin-right:auto;
left:0;
right:0;
}
.divider:before{
width:200px;
bottom:14px;
}
<section class="divider">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</section>
<section class="divider">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</section>
<section >Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</section>
Answered By - Prakash Rajotiya
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.