olfa ferjani
olfa ferjani

Reputation: 1

How can I select an image's class in CSS?

I currently have code like this:

.icones  {
  font-size: 10px;
  color: gray;
}
<div class="container-fluid">

        <div class="d-flex align-items-center justify-content-between header">
        
        <div class="col-md-4">
        <a class="coord" href="">
        <img src="{{ asset('build/menu.png') }}"class="icones">Menu</a>
        </div>

I currently seem to be unable to select the image's icones class. How can I correct the mistake?

Upvotes: 0

Views: 112

Answers (1)

Hamid Javadi
Hamid Javadi

Reputation: 211

It is an incorrect property usage on img tag.

You can use the font-size and color on the text HTML elements like H1,H2,H3,H4,H5,H6,P,span and a .... but the img tag is not a text element.

To change the font-size and color of your Menu, you should use the coord class setted on the a tag.

.coord  {
  font-size: 40px;
  color: gray;
}
<div class="container-fluid">
  <div class="d-flex align-items-center justify-content-between header">

    <div class="col-md-4">
      <a class="coord" href="">
      <img src="{{ asset('build/menu.png') }}"class="icones">Menu</a>
    </div>
  </div>
</div>

Upvotes: 2

Related Questions