- Courses
- HTML
- HTML top level tags
- <style>
- Media attribute's purpose in style
What is the purpose of the media
attribute in the <style>
element?
The media attribute specifies the media type for which the styles are intended.
The media
attribute in the <style>
element allows you to define which media the styles should be applied to, using a media query. This is useful for applying different styles based on the device's characteristics, such as screen width or resolution. If the attribute is not specified, the styles apply to all media types by default.
<style media="screen and (max-width: 600px)">
p { color: blue; }
</style>
More cards6
Show allHow does the
What is the function of the blocking
attribute in the <style>
element?
In the following code, what background color will the paragraph have?
<style>
p { background-color: blue; }
</style>
<style>
p { background-color: yellow; }
</style>
<p>This is my paragraph.</p>