How can I align the text that didn't fit the first line to right in CSS, like they do in poetry?

bedirhangn

I'm adding some poetry to my website. The problem is, when the screen size gets smaller, lines of the poem break. I want to show the part of the line that comes after the line break like they do in poetry books, when the verse doesn't fit the page width. Here's an example:

The quick brown fox jumps over the
                           lazy dog

The first line is aligned to left, the second however, is aligned to right. (This will only happen in small screens, of course.)

Is there any way to do this that is repeatable? This is not a one-time thing; I'm trying to create a standard with classes.

Temani Afif

Use text-align-last

.box {
  width: 350px;
  border: 1px solid #000;
  resize:horizontal;
  overflow:auto;
}
.box * {
  /*text-align:justify; uncomment this to see the justify effect, not bad too */
  text-align-last: right;
  display:inline-block;
}
<div class="box">
  <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div><br>
  <div>Ut enim ad minim veniam, quis nostrud exercitation ullamco.</div>
</div>

Este artigo é coletado da Internet.

Se houver alguma infração, entre em [email protected] Delete.

editar em
0

deixe-me dizer algumas palavras

0comentários
loginDepois de participar da revisão

Artigos relacionados

How do I align a div containing text and a div containing an image on the same line in CSS?

How can I align a Material icon & header text on the same line?

how do i align my th text in a same line

How can I use text-align-last except when I have only one line of text?

How can I fit a nonlinear line in R?

How can I align a <svg> element with text?

How do I align the text correctly in html

How do i center align with css inline

How can I tell which async task didn't complete?

How do I align sorting images in table headers to right

How do I align an <article> to the right, so that the <article> below stays below is, and I can put an image on the left of this <article>?

How do I align a photo next to text within a heading using HTML and CSS?

how can i make text best fit based on text length?

How do I vertically align text in text input at React Native?

How do I align two elements on the same line?

How do i align all these Read Mores in the same line in bootstrap

How can I vertically align dropdowns with non-dropdown text?

How can I align a text with a font awesome 5 icon?

How to relatively align text with CSS?

how can i align button bottom html css

How can i align button with input in a div, using CSS.

How can I align divs to father div in the center? Html css

How do I make a vertical line with text in the middle surrounded by two divs? - html/css

Text on the left with line on the right in HTML and CSS

Table text align right

QMenu Right Align Text

How can I append a div in jquery right after some text?

How do I place a FontAwesome Icon right next to text

How to align text according to above text in CSS?

TOP lista

  1. 1

    R Shiny: use HTML em funções (como textInput, checkboxGroupInput)

  2. 2

    O Chromium e o Firefox exibem as cores de maneira diferente e não sei qual deles está fazendo certo

  3. 3

    Como assinar digitalmente um documento PDF com assinatura e texto visíveis usando Java

  4. 4

    R Folheto. Dados de pontos de grupo em células para resumir muitos pontos de dados

  5. 5

    Gerenciar recurso shake de Windows Aero com barra de título personalizado

  6. 6

    Como obter dados API adequados para o aplicativo angular?

  7. 7

    UITextView não está exibindo texto longo

  8. 8

    Por que meus intervalos de confiança de 95% da minha regressão multivariada estão sendo plotados como uma linha de loess?

  9. 9

    Acessando relatório de campanhas na AdMob usando a API do Adsense

  10. 10

    Usando o plug-in Platform.js do Google

  11. 11

    Como posso modificar esse algoritmo de linha de visada para aceitar raios que passam pelos cantos?

  12. 12

    Dependência circular de diálogo personalizado

  13. 13

    Coloque uma caixa de texto HTML em uma imagem em uma posição fixa para site para desktop e celular

  14. 14

    iOS: como adicionar sombra projetada e sombra de traço no UIView?

  15. 15

    Como usar a caixa de diálogo de seleção de nomes com VBA para enviar e-mail para mais de um destinatário?

  16. 16

    Tabela CSS: barra de rolagem para a primeira coluna e largura automática para a coluna restante

  17. 17

    How to create dynamic navigation menu select from database using Codeigniter?

  18. 18

    Converter valores de linha SQL em colunas

  19. 19

    ChartJS, várias linhas no rótulo do gráfico de barras

  20. 20

    用@StyleableRes注释的getStyledAttributes。禁止警告

  21. 21

    não é possível adicionar dependência para com.google.android.gms.tasks.OnSuccessListener

quentelabel

Arquivo