P
P
Pavel2016-08-08 12:04:33
css
Pavel, 2016-08-08 12:04:33

How to display :after and :before in browser print preview?

Hello, actually there is css:

.sline {
    position: relative;
    border-bottom: 1px solid #555;
    padding: 0 5px;
}

span.sline:after {
    content : "";
    position: absolute;
    right    : 0;
    z-index: 100;
    bottom  : 0;
    width  : 1px;
    height   : 20%;
    background: #555
}
span.sline.all:before {
    content : "";
    position: absolute;
    left    : 0;
    z-index: 100;
    bottom  : 0;
    width  : 1px;
    height   : 20%;
    background: #555;
}

and html:
<span class="sline all">29</span><span class="sline">1588</span>

which generates this beauty:
https://jsfiddle.net/jz377z1p/
Only this beauty is not displayed in the preview and is not printed through the browser (the bottom border remains, the border that is drawn through :after and :before disappears) ... I don't very strong in css, tell me how to fix this misunderstanding?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Ankhena, 2016-08-08
@Ankhena

Give before and after one side border instead of a background

S
Sergey Tutukov, 2016-08-09
@sftutukov

Will only help for firefox.
Background - not displayed when printing, you need to use border in your case and everything will work

span.sline.all:before {
 border-right:1px solid #555;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question