×
1 Choose EITC/EITCA Certificates
2 Learn and take online exams
3 Get your IT skills certified

Confirm your IT skills and competencies under the European IT Certification framework from anywhere in the world fully online.

EITCA Academy

Digital skills attestation standard by the European IT Certification Institute aiming to support Digital Society development

SIGN IN YOUR ACCOUNT TO HAVE ACCESS TO DIFFERENT FEATURES

CREATE AN ACCOUNT FORGOT YOUR PASSWORD?

FORGOT YOUR DETAILS?

AAH, WAIT, I REMEMBER NOW!

CREATE ACCOUNT

ALREADY HAVE AN ACCOUNT?
EUROPEAN INFORMATION TECHNOLOGIES CERTIFICATION ACADEMY - ATTESTING YOUR PROFESSIONAL DIGITAL SKILLS
  • SIGN UP
  • LOGIN
  • SUPPORT

EITCA Academy

EITCA Academy

The European Information Technologies Certification Institute - EITCI ASBL

Certification Provider

EITCI Institute ASBL

Brussels, European Union

Governing European IT Certification (EITC) framework in support of the IT professionalism and Digital Society

  • CERTIFICATES
    • EITCA ACADEMIES
      • EITCA ACADEMIES CATALOGUE<
      • EITCA/CG COMPUTER GRAPHICS
      • EITCA/IS INFORMATION SECURITY
      • EITCA/BI BUSINESS INFORMATION
      • EITCA/KC KEY COMPETENCIES
      • EITCA/EG E-GOVERNMENT
      • EITCA/WD WEB DEVELOPMENT
      • EITCA/AI ARTIFICIAL INTELLIGENCE
    • EITC CERTIFICATES
      • EITC CERTIFICATES CATALOGUE<
      • COMPUTER GRAPHICS CERTIFICATES
      • WEB DESIGN CERTIFICATES
      • 3D DESIGN CERTIFICATES
      • OFFICE IT CERTIFICATES
      • BITCOIN BLOCKCHAIN CERTIFICATE
      • WORDPRESS CERTIFICATE
      • CLOUD PLATFORM CERTIFICATENEW
    • EITC CERTIFICATES
      • INTERNET CERTIFICATES
      • CRYPTOGRAPHY CERTIFICATES
      • BUSINESS IT CERTIFICATES
      • TELEWORK CERTIFICATES
      • PROGRAMMING CERTIFICATES
      • DIGITAL PORTRAIT CERTIFICATE
      • WEB DEVELOPMENT CERTIFICATES
      • DEEP LEARNING CERTIFICATESNEW
    • CERTIFICATES FOR
      • EU PUBLIC ADMINISTRATION
      • TEACHERS AND EDUCATORS
      • IT SECURITY PROFESSIONALS
      • GRAPHICS DESIGNERS & ARTISTS
      • BUSINESSMEN AND MANAGERS
      • BLOCKCHAIN DEVELOPERS
      • WEB DEVELOPERS
      • CLOUD AI EXPERTSNEW
  • FEATURED
  • SUBSIDY
  • HOW IT WORKS
  •   IT ID
  • ABOUT
  • CONTACT
  • MY ORDER
    Your current order is empty.
EITCIINSTITUTE
CERTIFIED

What are media queries and how do they enable responsiveness in web design?

by EITCA Academy / Monday, 07 August 2023 / Published in Web Development, EITC/WD/HCF HTML and CSS Fundamentals, Responsive websites, Introduction to responsive websites, Examination review

Media queries are an essential component of responsive web design, allowing websites to adapt and respond to different screen sizes and devices. In the field of web development, media queries are a CSS technique that enables the creation of responsive layouts and designs. They provide a way to apply different styles and rules based on the characteristics of the device or viewport.

A media query consists of a media type and one or more expressions that check specific conditions. The media type can be a broad category like "screen" for computer screens, "print" for printers, or "speech" for screen readers. The expressions within the media query determine when the associated styles should be applied.

Media queries use a range of features to evaluate conditions, such as the width and height of the viewport, the device's orientation (landscape or portrait), the resolution of the device's screen, the color capabilities, and even the user's preferred language. These features are referred to as media features, and they allow developers to target specific device characteristics.

To apply a media query, it is necessary to enclose the CSS rules within the query's block. For example, consider the following media query that targets screens with a maximum width of 600 pixels:

css
@media screen and (max-width: 600px) {
  /* CSS rules for screens up to 600 pixels wide */
}

In this example, the CSS rules within the media query block will only be applied when the screen width is 600 pixels or less. This technique allows developers to create styles that are optimized for smaller screens, providing a better user experience on mobile devices.

Media queries also support logical operators, allowing for more complex conditions. For instance, the "and" operator can be used to combine multiple media features. Consider the following media query that targets screens with a width between 600 and 900 pixels:

css
@media screen and (min-width: 600px) and (max-width: 900px) {
  /* CSS rules for screens between 600 and 900 pixels wide */
}

In this case, the CSS rules will be applied when the screen width is between 600 and 900 pixels.

Media queries can be used to create responsive designs by defining different styles for various screen sizes. By using multiple media queries with different conditions, developers can create a layout that adjusts and adapts to different devices seamlessly. For example, a website might have a three-column layout for large screens, a two-column layout for medium screens, and a single-column layout for small screens.

Here's an example of a media query that adjusts the layout based on screen size:

css
/* Default styles for all screens */
.column {
  width: 100%;
}

/* Media query for medium screens */
@media screen and (min-width: 600px) {
  .column {
    width: 50%;
  }
}

/* Media query for large screens */
@media screen and (min-width: 900px) {
  .column {
    width: 33.33%;
  }
}

In this example, the column elements will occupy the full width on small screens, 50% of the width on medium screens, and 33.33% of the width on large screens.

By utilizing media queries, web developers can create flexible and responsive designs that adapt to different devices and screen sizes. This approach enhances the user experience by ensuring that websites are readable, usable, and visually appealing across a wide range of devices.

Media queries are a powerful tool in web development that enable the creation of responsive websites. They allow developers to apply different styles and layouts based on the characteristics of the device or viewport. By using media queries, websites can seamlessly adapt to various screen sizes, providing an optimal user experience.

Other recent questions and answers regarding EITC/WD/HCF HTML and CSS Fundamentals:

  • Why is having a sitemap particularly important for large websites or websites with poorly linked content?
  • What steps are involved in creating and registering an XML sitemap with search engines like Google?
  • What is the difference between an HTML sitemap and an XML sitemap, and how does each serve its intended audience?
  • How can including a sitemap on the front page of a website benefit both users and search engines?
  • What are the primary functions of a sitemap in the context of website usability and SEO?
  • What are the benefits and potential drawbacks of over-applying the DRY principle in web development?
  • How can the DRY (Don't Repeat Yourself) principle be applied to CSS to improve maintainability and reduce errors?
  • What are some potential negative impacts of using non-semantic elements like `<div>` tags on SEO and performance?
  • How does the overuse of `<div>` tags affect the separation of concerns in web development?
  • What is "divitis" in HTML, and why is it considered a bad practice?

View more questions and answers in EITC/WD/HCF HTML and CSS Fundamentals

More questions and answers:

  • Field: Web Development
  • Programme: EITC/WD/HCF HTML and CSS Fundamentals (go to the certification programme)
  • Lesson: Responsive websites (go to related lesson)
  • Topic: Introduction to responsive websites (go to related topic)
  • Examination review
Tagged under: CSS, Media Queries, Responsive Design, Responsive Web Design, Web Development
Home » EITC/WD/HCF HTML and CSS Fundamentals / Examination review / Introduction to responsive websites / Responsive websites / Web Development » What are media queries and how do they enable responsiveness in web design?

Certification Center

USER MENU

  • My Account

CERTIFICATE CATEGORY

  • EITC Certification (106)
  • EITCA Certification (9)

What are you looking for?

  • Introduction
  • How it works?
  • EITCA Academies
  • EITCI DSJC Subsidy
  • Full EITC catalogue
  • Your order
  • Featured
  •   IT ID
  • EITCA reviews (Reddit publ.)
  • About
  • Contact
  • Cookie Policy (EU)

EITCA Academy is a part of the European IT Certification framework

The European IT Certification framework has been established in 2008 as a Europe based and vendor independent standard in widely accessible online certification of digital skills and competencies in many areas of professional digital specializations. The EITC framework is governed by the European IT Certification Institute (EITCI), a non-profit certification authority supporting information society growth and bridging the digital skills gap in the EU.

    EITCA Academy Secretary Office

    European IT Certification Institute ASBL
    Brussels, Belgium, European Union

    EITC / EITCA Certification Framework Operator
    Governing European IT Certification Standard
    Access contact form or call +32 25887351

    Follow EITCI on Twitter
    Visit EITCA Academy on Facebook
    Engage with EITCA Academy on LinkedIn
    Check out EITCI and EITCA videos on YouTube

    Funded by the European Union

    Funded by the European Regional Development Fund (ERDF) and the European Social Fund (ESF), governed by the EITCI Institute since 2008

    Information Security Policy | DSRRM and GDPR Policy | Data Protection Policy | Record of Processing Activities | HSE Policy | Anti-Corruption Policy | Modern Slavery Policy

    Automatically translate to your language

    Terms and Conditions | Privacy Policy
    Follow @EITCI
    EITCA Academy

    Your browser doesn't support the HTML5 CANVAS tag.

    • Web Development
    • Cloud Computing
    • Quantum Information
    • Cybersecurity
    • Artificial Intelligence
    • GET SOCIAL
    EITCA Academy


    © 2008-2026  European IT Certification Institute
    Brussels, Belgium, European Union

    TOP
    CHAT WITH SUPPORT
    Do you have any questions?
    We will reply here and by email. Your conversation is tracked with a support token.