Sometimes — on promo pages — we want to use tag <br> for neatly formatted text blocks "as in PSD" from designer. But using <br> isn't good, and on small screen of smartphone those blocks will have awkward views.
But we can use simple trick — set CSS media query with breakpoint (say, for smartphone screens), and set rule for <br> tag property display with value none. That force browser to remove <br> tags from flow, and text will be shown properly.
See an example below — on wide screen (open example in separate window) text shown as preformatted with breaks, on narrow screen (768 px and narrowed) — without breaks. (I used red background only as indicator of without-br mode.)
Комментариев нет :
Отправить комментарий
Примечание. Отправлять комментарии могут только участники этого блога.