0

I was trying to understand why only when content property is defined (with "" or any other text but defined) only than i can apply other css properties, For example if i remove the content property it's like there is no element and there is no other css properties apply, I would guess the content property is the "constructor" of the pseudo-element (:before or :after), At this Link i will quote:

Objects inserted using the content property

Object as i understand are the :before or :after pseudo-element,

Inserted(created)

Finally my question: Although all i said until now, am i right?, If anyone can help me with better explanation than i wrote i will be very thankful, Thank you all and have a nice day.

1
  • You are right. The CSS 2.1 spec, which defines :before and :after (CSS3 Selectors spec just links to it), says that the default value of the content property for these pseudo-elements computes to none, and the none value means that "The pseudo-element is not generated". Commented Aug 30, 2013 at 10:35

1 Answer 1

6

The initial value of content is none. When you don't define content, that value is used, and when that value is used, the pseudo-element is simply not generated at all. An empty string "" is not the same as none; the empty string means "insert an empty object", whereas none means "don't insert anything at all".

Indeed, saying "objects inserted" is basically the same as "pseudo-elements created" or "boxes rendered", etc.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.