Q:

is it possible to change class into div in media-query

My CSS code 
[class*="nav"] {width: 100%; }
    @media only screen and (min-width=1024px) {
    .nav {width= 38%;}
}

is it possible to change [class*="nav"] into [div*="nav"]

A:

If I understand you correct, the [class*="nav"] is an attribute selector and the class is the name of the attribute to target, in this case class, so if you want this to apply to a div and not to any other type of elements, containing nav in its class, you do like this

[class*="nav"] {
  position: relative;
  display: inline-block;
  width: 100%;
  padding: 10px;
  background: red;
  margin-bottom: 10px;
}

@media only screen and (min-width: 300px) {
    div[class*="nav"] { width: 38%; }
}
<div class="nav-bar">A div</div>
<span class="nav-item">A span</span>

Note, I changed your equal sign = in your @media rules to color :

