Home > Software engineering >  Changing font-weight to normal in h2
Changing font-weight to normal in h2

Time:11-22

I Want to change font-weight to normal of h2 element. I'm trying to do it by change it in parent directory.

h2 {
  margin: 0;
  padding: 0;
}
.top, .date {
  display: inline-block;
  width: 150px;
  height: 30px;
  border: 2px solid black;
  text-align: center;
}
.date {
  float: right;
  font-size: 16px; 
  font-weight: normal;  
}
<div id="instrument" >
  <h2>SP500</h2>
</div>
<div id="date" >
  <h2>Data</h2>
</div>
<div >
  <h2>Czas Zamknięcia</h2>
</div>

CodePudding user response:

I have no idea what you mean by parent directory, I guess you mean by selecting it with a parent tag/class/id, in that case, this is how you do it:

parent-tag h2 {
    font-weight: normal;
}

or if you want to do it by parent class/id name like this

.className/#idName h2 {
    font-weight: normal;
}

CodePudding user response:

h2 {
  margin: 0;
  padding: 0;
}
.top, .date {
  display: inline-block;
  width: 150px;
  height: 30px;
  border: 2px solid black;
  text-align: center;
}
.date {
  
  font-size: 16px; 
  font-weight: normal;  
}
   .date>h2 {
  
  font-size: 16px; 
  font-weight: normal !important;  
}
<div id="instrument" >
  <h2>SP500</h2>
</div>
<div id="date" >
  <h2>Data</h2>
</div>
<div >
  <h2>Czas Zamknięcia</h2>
</div>

  • Related