Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to apply some styles to first and last elements on a print page?
    primarykey
    data
    text
    <p>I have the following dummy <a href="http://jsfiddle.net/tQgB8/" rel="nofollow noreferrer">code</a>:</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; p {font-size: 20px;} &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; window.onload = function () { var body = document.getElementsByTagName('body')[0], p = document.createElement('p'), el; p.style.height = '20px'; p.innerText = 'Some Test'; for (var i = 0, len=30; i&lt;len; i++) { el = p.cloneNode(true); body.appendChild(el); } }; &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>It's render some <p> elements and on page preview it looks like the following: <img src="https://i.stack.imgur.com/4N1kg.png" alt="enter image description here"></p> <p>I need to add borders to first and last elements to be like the following: <img src="https://i.stack.imgur.com/WOObx.png" alt="enter image description here"></p> <p>Is it possible to make by using CSS and to get work in webkit?</p> <p><strong>EDIT: To everyone who advise the following css</strong></p> <pre><code>p:nth-child(1){ border-top : solid 1px gray; } p:last-child{ border-top : solid 1px gray; } </code></pre> <p>or</p> <pre><code>p:first-child {border-top : solid 1px gray;} p:last-child {border-bottom : solid 1px gray;} </code></pre> <p>That dont's work for me because it works accross all pages and looks like this: <img src="https://i.stack.imgur.com/PKV2a.png" alt="enter image description here"></p> <p>I need to work in chrome</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload