Can you add line breaks to the :after pseudo element?

前端 未结 3 1566
一整个雨季
一整个雨季 2020-12-05 16:42

I want to append a
to a particular class. Using the :after pseudo class simply displays
as text.

Is there a way t

3条回答
  •  暖寄归人
    2020-12-05 17:29

    You won't be able to render HTML tags but you can set style like this:

    .needs-space:after {
        content: " ";
        display: block;
        clear: both; /* if you need to break floating elements */
    }
    

    The main setting here is display: block; This will render :after content inside a DIV. And this pseudo element is supported by all latest browsers. Including IE. Saying this you should be aware of your users and their browsers.

提交回复
热议问题