pseudo-element

How to color the asterix first character in a p tag

﹥>﹥吖頭↗ 提交于 2019-12-03 05:35:44
I thought this would be easy using the ::first-letter pseudo element but it doesn't work! I have <p>* Required Fields</p> and I want the * to be red! Any ideas? Note I can't change the html. http://jsfiddle.net/3ducS/ I almost have a solution (well, you might see it as a solution) and it works with your HTML : p::before { content:'*'; position:absolute; color: red; text-shadow: 0 0 1px red; } Demonstration I launched a virtual machine to test on IE, it looks good : 来源: https://stackoverflow.com/questions/17835638/how-to-color-the-asterix-first-character-in-a-p-tag

Does the shadow DOM replace ::before and ::after?

心不动则不痛 提交于 2019-12-03 05:15:36
CSS Scoping says The descendants of a shadow host must not generate boxes in the formatting tree. Instead, the contents of the active shadow tree generate boxes as if they were the contents of the element instead. CSS Pseudo-Elements describes ::before and ::after as these pseudo-elements generate boxes as if they were immediate children of their originating element So which of these is true? First, all the contents of the shadow host (not including ::before and ::after ) are replaced by the contents of the active shadow tree. And then, ::before and ::after generate boxes in the shadow host.

Why do I need an empty `content` property on an ::after pseudo-element? [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-03 04:34:16
This question already has answers here : Why do the :before and :after pseudo-elements require a 'content' property? (4 answers) I got http://jsfiddle.net/8p2Wx/2/ from a previous question I asked and I see these lines: .cf:before, .cf:after { content:""; display:table; } .cf:after { clear:both; } If I take away content:"" , it ruins the effect, and I don't understand why it's necessary. Why is it needed to add an empty content to :after and :before pseudo-elements? You cannot style generated content without defining what that content should be. If you don’t really need any content, just an

How do I override CSS set on a pseudo element?

戏子无情 提交于 2019-12-03 04:04:08
问题 I know that has been asked before, but I find no clean way of overriding this CSS: .ui-input-search:after { content: ""; height: 18px; left: 0.3125em; margin-top: -9px; opacity: 0.5; position: absolute; top: 50%; width: 18px; } I need to leave ui-input-search on the element, but can add my own class, like: .ui-input-search-no-pseudo:after { content: ""; } Question : Is there an easy way to remove "pseudo-css" without having to overwrite the CSS line by line? Thanks! 回答1: As far as I can tell

Use Pseudo Element to Create Background Overlay

ε祈祈猫儿з 提交于 2019-12-02 23:36:13
My goal is to have a div with any background, which then uses a pseudo element to create a transparent white overlay, thus "lightening" the background of the div. The "overlay" must be UNDER the contents of the div, though. So, in the following example: <div class="container"> <div class="content"> <h1>Hello, World</h1> </div> </div> .container { background-color: red; width: 500px; height: 500px; position: relative; } .content { background-color: blue; width: 250px; } .container::before { content:""; display: block; height: 100%; position: absolute; top: 0; left: 0; width: 100%; z-index: 1;

How do I override CSS set on a pseudo element?

痴心易碎 提交于 2019-12-02 17:23:50
I know that has been asked before, but I find no clean way of overriding this CSS: .ui-input-search:after { content: ""; height: 18px; left: 0.3125em; margin-top: -9px; opacity: 0.5; position: absolute; top: 50%; width: 18px; } I need to leave ui-input-search on the element, but can add my own class, like: .ui-input-search-no-pseudo:after { content: ""; } Question : Is there an easy way to remove "pseudo-css" without having to overwrite the CSS line by line? Thanks! Sacha As far as I can tell there is no other way than to override all properties. The styles are defined on the element, they won

css3 “::after” pseudo-element not working

我们两清 提交于 2019-12-02 06:40:15
问题 I want to add a triangle after a div tag.Therefore i used css3 after pseudo-element. But it's not working. Following is my css rule. .header-wrapper .part1 ::after { width: 0; height: 0; border-left: solid 48.35px #f21e1e; border-bottom: solid 48.35px transparent; border-top: solid 48.35px transparent; } Following is my html part <div class="header-wrapper"> <div class="part1"></div> </div> 回答1: In order for the pseudo element to be generated, you need to specify a content value. The value is

Getting :before pseudo element to use background image of parent

我是研究僧i 提交于 2019-12-02 04:06:40
问题 Can CSS be used to set the background image of a :before pseudo element to the same as it's parent. I want to say inherit, but can a pseudo element inherit anything? Example: li a { background: #f56a46 url(images/gallery-thumb.jpg) center center no-repeat; } li a:before { background: inherit; } I know I could easily do it with JavaScript but I want to know if it's possible using only CSS. Any help would be much appreciated, Thanks! 回答1: Inherit must work for pseudo-elements: http://jsfiddle

firefox adds strange space arround Pseudo-elements

南笙酒味 提交于 2019-12-02 03:45:18
Take a look at these photos JSFiddle link at the bottom firefox: chrome: they are both the same element taken from chrome and firefox and as you can see the one from firefox has some space around it's top and left side but the one from chrome doesn't now, There is no margin or anything that's causing this and it works fine in any other browser except for firefox. the important styles for the main element is float: left; height: 30px; line-height: 30px; margin: 12.5px 0; and for the Pseudo-element ::before float: left; display: block; content: '\F011'; height: 30px; line-height: 30px; margin: 0

What is it in a pseudo-element that makes the pseudo-element pseudo?

爷,独闯天下 提交于 2019-12-02 03:30:11
In my other question What does "pseudo" mean in CSS? I got this answer: "A pseudo-element is something that acts like an element, but is not an element". What is it that makes pseudo-element not an element? A pseudo element is not in the dom. That is what makes it not an element. It is an element created by CSS. Pseudo elements cannot be seen or manipulated by various technologies. For example, many JavaScript methods don't work for pseudo elements. That is why it is "not an element." To explain further: Elements are items in the dom. For example, div, p, and span are all html elements. They