I am looking to enhance a div element by incorporating a specific class from a separate CSS file. For example, my HTML file contains the following snippet:
/* width 90% */
@media (min-width: 960px) {
div.width90 {
max-width: 90%;
}
}
<div class="width90">
text in div with a 90% width
</div>
However, I am experiencing difficulties as the styling does not seem to take effect even after removing the media query. Despite conducting research online for solutions, I am still struggling due to insufficient familiarity with this technique.
My intention behind utilizing this class is to display text within a div block at a width of 90%, specifically on screens wider than 960px.
If I directly apply the style within the HTML, it functions across all screen sizes, leading to my desire to encapsulate it within a class:
<div style="width: 90%">
text in div with a 90% width
</div>
Could you please provide guidance on the correct code to achieve this desired outcome? I trust that I have articulated the issue clearly enough! ;)
Thank you, Ellen