Break lines in CSS without using extra elements


I have 2 elements inline and I need to cause the line to be broken, without needing to add display: block; or if possible add but not occupy 100% of the line:

<div class="box-error-page cb">
    <h1 class="title-page-error title-error-default fleft">

    <h2 class="title-not-found title-error-default">
        Ops! Página não encontrada

    <p>Não foi possível localizar o link que você estava buscando.</p>

    <a href="" class="cb">Ir à página inicial</a>
    <a href="javascript:history.go(-1);" class="cb">Voltar à página anterior</a>

In the case of the 2 links at the end, they should break line, I wanted to see if there was any way, without the need to use extra elements, just to break the line, I know I could do with UL>LI . >     

asked by anonymous 21.08.2014 / 15:50

1 answer


You can use the pseudo-element :after

a:after{content:""; display:block; clear:both}

:after works from IE8. With it you create an element in CSS, so you do not need to tinker with your HTML.

Example: link

21.08.2014 / 16:00