i have some '<a> <i> <label>'
in my page like below with the class
<a class="icon-home"></a>
<label class="icon-pencil"></label>
<i class="icon-display"></i>
i need to create css with margin-right:10px
when class start with "icon-"
some thing like below:
<style>
.icon-* {margin-right:10px}
</style>
class selector selects elements with a specific class attribute. To select elements with a specific class, write a period (.) character, followed by the name of the class. You can also specify that only specific HTML elements should be affected by a class.
You can create a selector that will target specific elements with the class applied.
To use an ID selector in CSS, you simply write a hashtag (#) followed by the ID of the element. Then put the style properties you want to apply to the element in brackets.
Try this:
[class^="icon-"], [class*=" icon-"] {
margin-right: 10px;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With