Book Top Rank with Contact Details visibility for your Business, Profession, Products or Services

content property in CSS

Question by Saravana s On 27 September 2022, 20:28:01

(Page Views: 155)

Answer by Saravana s On 27 September 2022, 20:29:45

What is the content property?

Values : "string" | open-quote | close-quote | url("filepath") | none

CSS content property is used to generate content dynamically at runtime. It is also used to generate content before or after the content of HTML elements. To the CSS content property, we can assign various values, we can assign string which means a sequence of characters enclosed in double quotations. We can also assign predefined values like an open quote, closed quote etc. We can also assign the URL of a resource it may be an image etc. Let's see some practical examples

Adding string using content property

.string::before{
content: "Welcome ";
}
.string::after{
content: " HTML ";
}
<span class="string">To</span>
//output
// Welcome To HTML

Read more>>