The Tech Edvocate

Top Menu

  • Advertisement
  • Apps
  • Home Page
  • Home Page Five (No Sidebar)
  • Home Page Four
  • Home Page Three
  • Home Page Two
  • Home Tech2
  • Icons [No Sidebar]
  • Left Sidbear Page
  • Lynch Educational Consulting
  • My Account
  • My Speaking Page
  • Newsletter Sign Up Confirmation
  • Newsletter Unsubscription
  • Our Brands
  • Page Example
  • Privacy Policy
  • Protected Content
  • Register
  • Request a Product Review
  • Shop
  • Shortcodes Examples
  • Signup
  • Start Here
    • Governance
    • Careers
    • Contact Us
  • Terms and Conditions
  • The Edvocate
  • The Tech Edvocate Product Guide
  • Topics
  • Write For Us
  • Advertise

Main Menu

  • Start Here
    • Our Brands
    • Governance
      • Lynch Educational Consulting, LLC.
      • Dr. Lynch’s Personal Website
      • Careers
    • Write For Us
    • The Tech Edvocate Product Guide
    • Contact Us
    • Books
    • Edupedia
    • Post a Job
    • The Edvocate Podcast
    • Terms and Conditions
    • Privacy Policy
  • Topics
    • Assistive Technology
    • Child Development Tech
    • Early Childhood & K-12 EdTech
    • EdTech Futures
    • EdTech News
    • EdTech Policy & Reform
    • EdTech Startups & Businesses
    • Higher Education EdTech
    • Online Learning & eLearning
    • Parent & Family Tech
    • Personalized Learning
    • Product Reviews
  • Advertise
  • Tech Edvocate Awards
  • The Edvocate
  • Pedagogue
  • School Ratings

logo

The Tech Edvocate

  • Start Here
    • Our Brands
    • Governance
      • Lynch Educational Consulting, LLC.
      • Dr. Lynch’s Personal Website
        • My Speaking Page
      • Careers
    • Write For Us
    • The Tech Edvocate Product Guide
    • Contact Us
    • Books
    • Edupedia
    • Post a Job
    • The Edvocate Podcast
    • Terms and Conditions
    • Privacy Policy
  • Topics
    • Assistive Technology
    • Child Development Tech
    • Early Childhood & K-12 EdTech
    • EdTech Futures
    • EdTech News
    • EdTech Policy & Reform
    • EdTech Startups & Businesses
    • Higher Education EdTech
    • Online Learning & eLearning
    • Parent & Family Tech
    • Personalized Learning
    • Product Reviews
  • Advertise
  • Tech Edvocate Awards
  • The Edvocate
  • Pedagogue
  • School Ratings
  • A Visitors Guide to Viña del Mar, Chile

  • A Visitors Guide to Århus, Denmark

  • A Visitors Guide to Bakersfield (CA), United States

  • A Visitors Guide to Aurora (CO), United States

  • A Visitor’s Guide to Toledo (OH), United States

  • A Visitors Guide to Cincinnati (OH), United States

  • The MagicEagle Cam 5: Revolutionizing Wildlife Monitoring with Smart 4G Technology

  • A Visitors Guide to Pittsburgh (PA), United States

  • A Visitors Guide to Colorado Springs (CO), United States

  • 5 Pairs of Shoes That Will Instantly Step Your Shoe Game Up

Assistive Technology
Home›Assistive Technology›How to Use Media Queries in HTML and CSS to Create Responsive Websites

How to Use Media Queries in HTML and CSS to Create Responsive Websites

By Matthew Lynch
June 15, 2023
0
Spread the love

As the use of smart devices continues to rise, responsive design is becoming an essential aspect of web development. Websites must be optimized for all screen sizes, including desktop, tablet, and mobile devices. One approach to achieving this is through media queries in HTML and CSS.

Media queries are conditional statements used in CSS to alter the style of a page based on the size of the device displaying it. Implementing media queries enables developers to create responsive websites that adapt to a user’s screen size without requiring them to zoom in or out.

To begin using media queries, you must first add them to the CSS file of your project. This is done by using the ‘@media’ rule followed by a set of curly braces. The curly braces contain the styling rules that apply to the specified device size.

For instance, suppose you want to modify the text size for a screen with a maximum width of 768 pixels. In that case, you would use the following code:

“`

@media only screen and (max-width: 768px) {

body {

font-size: 16px;

}

}

“`

This code specifies that the styling rules within the curly braces will apply only to screens with a maximum width of 768 pixels. In this case, the font-size will be changed to 16px for smaller screens.

Another common example of media queries in responsive website design is changing the layout of the page based on the screen size. This can be achieved with the use of flexbox or grid. Here is an example:

“`

@media only screen and (max-width: 768px) {

.container {

display: flex;

flex-direction: column;

}

.item {

width: 100%;

}

}

“`

This code specifies that the layout of the container and item elements will change for screens with a maximum width of 768 pixels. The container changes its display property to flex, and the flex-direction changes to column, making it stack vertically. The item changes its width to 100% to fill the entire container’s width.

Previous Article

Key Technologies Used in the Manufacturing Industry

Next Article

Does Apple Music Have Podcasts?

Matthew Lynch

Related articles More from author

  • Assistive Technology

    How to Format a USB Drive Into NTFS Format in Windows 11

    August 5, 2023
    By Matthew Lynch
  • Assistive Technology

    How to Use the Off Facebook Activity Tool to Protect Your Privacy

    June 14, 2023
    By Matthew Lynch
  • Assistive Technology

    How to Edit, Reposition, and Compress Images in Microsoft Word

    June 12, 2023
    By Matthew Lynch
  • Assistive Technology

    How to Turn On Bluetooth in Windows 7

    June 10, 2023
    By Matthew Lynch
  • Assistive Technology

    How to Back Up and Restore Windows 10 Device Drivers

    June 12, 2023
    By Matthew Lynch
  • Assistive Technology

    Ways to Make Windows 10 Faster and Improve Performance

    June 14, 2023
    By Matthew Lynch

Search

Login & Registration

  • Register
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Newsletter

Signup for The Tech Edvocate Newsletter and have the latest in EdTech news and opinion delivered to your email address!

About Us

Since technology is not going anywhere and does more good than harm, adapting is the best course of action. That is where The Tech Edvocate comes in. We plan to cover the PreK-12 and Higher Education EdTech sectors and provide our readers with the latest news and opinion on the subject. From time to time, I will invite other voices to weigh in on important issues in EdTech. We hope to provide a well-rounded, multi-faceted look at the past, present, the future of EdTech in the US and internationally.

We started this journey back in June 2016, and we plan to continue it for many more years to come. I hope that you will join us in this discussion of the past, present and future of EdTech and lend your own insight to the issues that are discussed.

Newsletter

Signup for The Tech Edvocate Newsletter and have the latest in EdTech news and opinion delivered to your email address!

Contact Us

The Tech Edvocate
910 Goddin Street
Richmond, VA 23231
(601) 630-5238
[email protected]

Copyright © 2025 Matthew Lynch. All rights reserved.