html - CSS align text to the right but align left on line break -


i trying align text right when text long, should make line break , align left of text. it's hard me explain, that's why have image of i'm trying do:

enter image description here

as can see, text aligned right of small div. when line break occurs, logically aligned right.

i tried wrap in div, parent aligned right , child text left. thing result this:

enter image description here

which still wrong, since text isn't aligned right then, when breaks. there way that? , don't wanna have max width or text, since if there enough space, should take whole width available line.

body {      background: #cccccc;  }    .parentdiv {    width: 100px;    height: 100px;    background-color: white;    display: flex;    flex-direction: column;  }    .alignright {    margin-left: auto;  }    .alignleft {    text-align: left;    padding-bottom: 5px;  }
<div class="parentdiv">    <div class="alignright">      <div class="alignleft">        bla      </div>    </div>    <div class="alignright">      <div class="alignleft">        testing cool text      </div>    </div>  </div>

first answer:

p.para{  text-indent: 30px;  padding-left:15px;  }
<p class="para">    hello text. story awesome. hello text. story awesome. hello text. story awesome. hello text. story awesome. hello text. story awesome.hello text. story awesome.hello text. story awesome.hello text. story awesome.hello text. story awesome  </p>

edit:

or break text this..where can play first line , rest para anyhow like.

div.para>p:first-child{  	text-align:right;  	margin-bottom:0px;  }  div.para>p:last-child{  	margin-top:0px;    text-align:left;  	padding-left:10px;  }
<div class="para">      <p>this first line</p>      <p>          rest of lines... text. story awesome. hello text. story awesome.hello text. story awesome.hello text. story awesome.hello text. story awesome.hello text.          story awesome.hello text. story awesome.hello text. story awesome.hello text. story awesome      </p>  </div>

even if not intention at

html/css: how put text both right , left aligned in paragraph


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -