pseudo-element

“text-decoration” and the “:after” pseudo-element, revisited

左心房为你撑大大i 提交于 2019-11-26 20:27:47
I'm re-asking this question because its answers didn't work in my case. In my stylesheet for printed media I want to append the url after every link using the :after pseudo-class. a:after { content: " <" attr(href) ">"; text-decoration: none; color: #000000; } In Firefox (and probably Chrome but not IE8), text-decoration: none is ignored, and the underline stretches unattractively across the bottom of the url. The color however is correctly set to black for the url. Is there a way to make the text-decoration work? The original question appended fixed size images instead of variable width text.

How to make a hover effect for pseudo elements?

心已入冬 提交于 2019-11-26 19:23:40
问题 I have a this setup: <div id="button">Button</div> and this for CSS: #button { color: #fff; display: block; height: 25px; margin: 0 10px; padding: 10px; text-indent: 20px; width: 12%; } #button:before { background-color: blue; content: ""; display: block; height: 25px; width: 25px; } Is there a way to give the pseudo element a hover effect such as #button:before:hover {...} and is it also possible to get the pseudo element to hover in response to another element being hovered like so: #button

Can I have multiple :before pseudo-elements for the same element?

…衆ロ難τιáo~ 提交于 2019-11-26 18:51:14
Is it possible to have multiple :before pseudos for the same element? .circle:before { content: "\25CF"; font-size: 19px; } .now:before{ content: "Now"; font-size: 19px; color: black; } I am trying to apply the above styles to the same element using jQuery, but only the most recent one is applied, never both of them. BoltClock In CSS2.1, an element can only have at most one of any kind of pseudo-element at any time. (This means an element can have both a :before and an :after pseudo-element — it just cannot have more than one of each kind.) As a result, when you have multiple :before rules

Using CSS :before and :after pseudo-elements with inline CSS?

青春壹個敷衍的年華 提交于 2019-11-26 18:46:40
I'm making an HTML email signature with inline CSS (i.e. CSS in style attributes), and I am curious as to whether it's possible to use the :before and :after pseudo-elements. If so, how would I implement something like this with inline CSS? td { text-align: justify; } td:after { content: ""; display: inline-block; width: 100%; } BoltClock You can't specify inline styles for pseudo-elements. This is because pseudo-elements, like pseudo-classes (see my answer to this other question ), are defined in CSS using selectors as abstractions of the document tree that can't be expressed in HTML. An

after pseudo element not appearing in code [duplicate]

一曲冷凌霜 提交于 2019-11-26 18:32:43
问题 This question already has answers here : Why do the :before and :after pseudo-elements require a 'content' property? (4 answers) Closed 3 years ago . I'm trying to use the after pseudo element to add some effects to a site. <div class="product-show style-show"> <ul> <li> .... <div class="..."> <div class="readMore less">...</div> <a href="3" class="readMoreLink" onclick="return false;">Read More</a> </div> .... </li> </ul> </div> And stylesheets: .product-show .readMore.less { max-height:

CSS Pseudo Element Counters: can you increment an alphabet letter “a”, “b”, “c”, etc instead of a number?

ε祈祈猫儿з 提交于 2019-11-26 18:11:18
问题 As defined here: http://www.w3.org/TR/CSS21/generate.html#propdef-counter-increment You can use code like the following to increment numbers in pseudo elements. H1:before { content: "Chapter " counter(chapter) ". "; counter-increment: chapter; /* Add 1 to chapter */ } H1 { counter-reset: section; /* Set section to 0 */ } H2:before { content: counter(chapter) "." counter(section) " "; counter-increment: section; } Is there a way you can use the same code to increment letters like "a", "b", "c"

Combine :after with :hover

余生颓废 提交于 2019-11-26 17:56:32
问题 I want to combine :after with :hover in CSS (or any other pseudo selector). I basically have a list and the item with the selected class has an arrow shape applied using :after . I want the same to be true for objects that are being hovered over but cant quite get it to work. Heres the code #alertlist { list-style:none; width: 250px; } #alertlist li { padding: 5px 10px; border-bottom: 1px solid #e9e9e9; position:relative; } #alertlist li.selected, #alertlist li:hover { color: #f0f0f0;

Combine CSS Attribute and Pseudo-Element Selectors?

蓝咒 提交于 2019-11-26 17:28:58
问题 How can I combine a pseudo-element selector ( :after ) with an attribute selector ( [title] )? I tried using div[title]:after , but this doesn't work in Chrome. HTML: <div title="foo">This div has a title.</div> <div>This div does not have a title.</div> CSS: div:after { content: "NO"; } div[title]:after { content: "YES"; } Demo: http://jsfiddle.net/jmAX6/ It shows me "YES" at the end of each of those div's, when it should show "NO" after the second div. I'm running Chrome 17.0.963.38. It

CSS First Letter Highlighting

懵懂的女人 提交于 2019-11-26 17:23:49
问题 I understand that with CSS formatting the first letter of each paragraph is possible via: p:first-letter { font-size:20px; } However upon using this code it is impossible to highlight/select these "First Letters" from the web browser, is there a way to amend this? Edit - It is possible to select the text, however it isn't shown visually, how can I change this? 回答1: This is a bug in Chrome/ium/WebKit: https://code.google.com/p/chromium/issues/detail?id=17528 回答2: Right, it is not visually

How to update placeholder color using Javascript?

被刻印的时光 ゝ 提交于 2019-11-26 17:22:31
问题 I'm searching online and I didn't find anything. I'm trying to update the placeholder color of a textbox using javascript, but how can I do that? I have a color picker and the color is changing. If I have something like this in my CSS, how can I update it? ::placeholder { color: red; } <input placeholder="placeholder" /> Is there a javascript command to edit this? Something like document.getElementById('text').style.placeholderColor = newColor; 回答1: Use CSS variables. You can also target only