Can we write selectors by only name
For example,
<div name= "outer-name">
<img name="inner-image" src="images/ine.jpg" alt"" />
</div>
I want to take style of inner-mage in css file like [outer-name] [inner-image]
In CSS file
[outer-name] [inner-image] {
/*styles*/
}
I cant take selector as [outer-name] img etc .. only selecting by name
You can use attribute selectors:
But keep in mind that
nameis not a valid attribute for<div>or<img>, even though the above selector will work. It’s best that you either change them to classes, or if you’re using HTML5, add thedata-prefix to them, so it looks like this:Then use this selector: