I think you've become a little confused with pseudo elements, so i'll hopefully clear a few things up for you:
The ::after pseudo-element can be used to describe generated content after an element's content.
A quick demonstration of this would be:
p::after {
content: " :Note";
}
<p>In CSS 2.1, it is not possible to refer to attribute values for other elements than the subject of the selector.</p>
See how, no matter where the div is, the pseudo element will be displayed after the element it is attached to. This is the way pseudo elements were designed for -to add content before
or add content after
.
This means that the :after is positioned relatively to the 'real' element, and not appear after the 'scrollbars'.
Instead, if you position your pseudo element absolutely, then as you would expect with positioning a child element, you can 'move' it using the left
, right
, top
and bottom
properties:
div.box {
background-color: #FAA;
width: 10em;
overflow: scroll;
}
div.box:after {
content: "☑";
position:absolute;
display: block;
background-color: #AFA;
width: 5em;
overflow: auto;
}
<div class="box">x</div>
Note
However, I would instead wrap the scrollable content in a div, and that way you would have much more control over the positioning of the element.
The similarities in ::after
and :after
This [double-colon] notation is introduced … in order to establish a
discrimination between pseudo-classes and pseudo-elements. For
compatibility with existing style sheets, user agents must also accept
the previous one-colon notation for pseudo-elements introduced in CSS
levels 1 and 2 (namely, :first-line, :first-letter, :before and
:after). This compatibility is not allowed for the new pseudo-elements
introduced in CSS level 3. ~Spec
So, The short answer is..
There is no difference between the two notations
The slightly Long answer is...
With the introduction of CSS3, in order to make a differentiation between pseudo-classes and pseudo-elements, in CSS3 all pseudo-elements must use the double-colon syntax (::after
), and all pseudo-classes must use the single-colon syntax (:first-child
).
However, since IE8 and below doesn't understand this 'double colon' syntax (amongst so many others), browsers will accept the single colon syntax anyway (allowing IE 8 and below to also understand it). This is why developers, on the broad side, have chosen to keep using the single colon syntax in order for IE8 (and below) to understand, giving your site better browser compatability.
Further Reading