center h1 in the middle of screen [duplicate]

you can use display flex it enables a flex context for all its direct children, and with flex direction establishes the main-axis, thus defining the direction flex items are placed in the flex container div{ height: 400px; width: 800px; background: red; display: flex; flex-direction: column; justify-content: center; text-align: center; }

Bootstrap: how to not have text-right in certain size?

Bootstrap 4 has added new css classes for this purpose: <p class=”text-sm-right”>Right aligned text on viewports sized SM (small) or wider.</p> <p class=”text-md-right”>Right aligned text on viewports sized MD (medium) or wider.</p> <p class=”text-lg-right”>Right aligned text on viewports sized LG (large) or wider.</p> <p class=”text-xl-right”>Right aligned text on viewports sized XL (extra-large) or wider.</p>

Justify the last line of a div?

Here’s a cross-browser method that works in IE6+ It combines text-align-last: justify; which is supported by IE and a variation of the :after pseudo-content method. It includes a fix to remove extra space added after one line text elements. CSS: p, h1{ text-align: justify; text-align-last: justify; } p:after, h1:after{ content: “”; display: inline-block; width: 100%; … Read more

“text-align: justify;” inline-block elements properly?

Updated the “Future” solution info below; still not yet fully supported. Present Workaround (IE8+, FF, Chrome Tested) See this fiddle. Relevant CSS .prevNext { text-align: justify; } .prevNext a { display: inline-block; position: relative; top: 1.2em; /* your line-height */ } .prevNext:before{ content: ”; display: block; width: 100%; margin-bottom: -1.2em; /* your line-height */ } … Read more