pseudo-element

Universal selector * and pseudo elements

流过昼夜 提交于 2019-11-27 07:40:20
Does the universal selector * affect pseudo elements like :before and :after ? Let me use an example: When doing this: * { box-sizing: border-box; } ...doesn't the above declaration automatically include/affect pseudo elements like :before and :after as well? Or, in order to affect pseudo elements like :before and :after , one has to declare this? *, *:before, *:after { box-sizing: border-box; } Does this make sense? I have always used just * { box-sizing: border-box; } and never have had any issues with pseudo elements whatsoever. But I see many tutorials doing *, *:before, *:after but they

How can I create custom tooltips with css pseudoelements

六月ゝ 毕业季﹏ 提交于 2019-11-27 07:15:39
问题 I am reading css-tricks and in the end I can see the following. Using an HTML5 data attribute, then pulling that attribute in and styling it as a pseudo element, we can create completely custom tooltips through CSS. The problem is that the link inside of the article is dead, and I am not such a good html/css guy to be able to understand how to do this. Can anyone help? 回答1: JSFiddle is here. Note: The original content is here. HTML <p>Vestibulum mollis mauris <a href="#" class="tooltip" title

“text-decoration” and the “:after” pseudo-element [duplicate]

隐身守侯 提交于 2019-11-27 06:15:11
问题 This question already has an answer here: “text-decoration” and the “:after” pseudo-element, revisited 11 answers Like all right-thinking people, I hate to click on a link and discover too late that it leads to a browser-crippling PDF or Microsoft Office file. I thought I'd make life a bit easier for people by displaying a little icon next to links that lead to such files. With IE8 finally supporting the :after pseudo-element, I thought the CSS declaration would be fairly simple: a.file_pdf

Applying WebKit transitions to Pseudo Elements

◇◆丶佛笑我妖孽 提交于 2019-11-27 06:01:24
问题 I have made a Fiddle for reference: http://jsfiddle.net/xypQY/ Which element would i apply WebKit transitions on to achieve a Fade In effect using opacity? 回答1: This is a webkit bug, transitions do not work in Chrome or Safari on pseudo-elements. Please star this bug to hopefully help the ball get rolling on a fix: Issue 54699: CSS3 transition not applied for pseudo elements It has been reported to Webkit: Bug 23209 - Transitions and animations do not apply to CSS generated content so

CSS: How to remove pseudo elements (after, before,…)?

心已入冬 提交于 2019-11-27 05:03:03
问题 I would like to use a switch for the layout of paragraph tags on a webpage. I use the after pseudoelement: p:after {content: url("../img/paragraph.gif");} Now I need to remove this CSS code from the page. How can this be done easily? I want to add that: jQuery is already used on the page and I do not want to include or remove files containing CSS. 回答1: p:after { content: none; } none is the official value to set the content, if specified, to nothing. http://www.w3schools.com/cssref/pr_gen

CSS data attribute new line character & pseudo-element content value

岁酱吖の 提交于 2019-11-27 03:55:50
Is it possible to have a new line in a data attribute ? I am trying to do something like this: CSS: [data-foo]:after { content: attr(data-foo); background-color: black; } HTML <div data-foo="First line \a Second Line">foo</div> I found that "\a" is a new line in CSS, but still does not work for me. Here is how this can work. You need to modify your data attribute as follows: <div data-foo='First line Second Line'>foo</div> and the CSS (proof of concept): [data-foo]:after { content: attr(data-foo); background-color: black; color: white; white-space: pre; display: inline-block; } Fiddle Demo:

Combine CSS Attribute and Pseudo-Element Selectors?

狂风中的少年 提交于 2019-11-27 02:10:55
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 seems to work fine in Safari 5.1.2. This looks like a bug, which has finally been reported . If you add a

Nesting pseudo-elements inside pseudo-elements

假如想象 提交于 2019-11-27 01:55:26
I have a :before for an opening 'quote' and an :after for a closing quote. Now what I want is an :after:after for the 'cite' reference but I cant get it to work. Does anyone know if this is possible? My code so far:- blockquote:before { content: '\201C'; } blockquote:after { content: '\201D'; } blockquote { font-size: 22px; line-height: 24px; text-indent:60px; } blockquote:before { font-size: 170px; margin-left: -136px; margin-top: 50px; opacity: 0.2; position: absolute; overflow:visible; float:left; width:135px; } blockquote:after { float: right; font-size: 170px; margin-right: 35px; margin

Target :before and :after pseudo-elements with jQuery [duplicate]

我只是一个虾纸丫 提交于 2019-11-27 01:49:08
Possible Duplicate: Manipulating CSS pseudo-elements using JQuery On pageload I want the :before and :after elements on a class to appear. I've set the .lifted:before and .lifted:after to be opacity:0 in the css. Within document ready I have: $(".lifted:before").css("opacity", "1"); $(".lifted:after").css("opacity", "1"); This doesn't work. And the .after jQuery manipulator is only made for inserting content as far as I can tell. Is there any way I can manipulate the css of these pseudo-elements using jQuery? Decided to go with the solution of adding a class on load to the element and then

Should I use single colons (:) or double colons (::) for before, after, first-letter and first-line pseudo-elements?

你。 提交于 2019-11-27 01:45:37
From MDN: The :: notation was introduced in CSS 3 in order to establish a discrimination between pseudo-classes and pseudo-elements. Browsers also accept the notation : introduced in CSS 2. If the notation : will always be accepted by CSS3 browsers, should I use it because it works on old and new browsers? Or should I use both of them, : for old browsers and :: for new ones, because the notation : won't be always accepted? Note : I think my question isn't a duplicate isn't a duplicate of Should I use single or double colon notation for pseudo-elements? because the other question asks about