Join Regular Classroom : Visit ClassroomTech

CSS – codewindow.in

Related Topics

HTML

Introduction
Html page 1
Html page 2
Html page3
Html page4

HTML Elements and structure
Html page 5
Html page 6
Html page 7

HTML Headings and Paragraphs
Html page 8
Html page 9
Html page 10

HTML Lists and Tables
Html page 11
Html page 12
Html page 13

HTML Forms and Input Fields
Html page 14
Html page 15
Html page 16

HTML Images and Media
Html page 17
Html page 18

HTML Links and Anchors
Html page 19
Html page 20
Html page 21

HTML Styles and Formatting
Html page 22

HTML Semantic Elements
Html page 23
Html page 24

HTML Attributes
Html page 25
Html page 26

HTML JavaScript Integration
Html page 27
Html page 28
Html page 29
Html page 30

HTML Document and Browser Support
Html page 31
Html page 32

HTML5 New Elements and Attributes
Html page 33
Html page 34
Html page 35
Html page 36

HTML Accessibility and Web Standards
Html page 37
Html page 38
Html page 39

HTML Responsive Design and Mobile Devices.
Html page 40
Html page 41
Html page 42

CSS

<div class="container">
  <h1 class="title">Responsive Design</h1>
  <p class="description">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>

CSS:

.container {
  /* Common styles for all devices */
}

.title {
  /* Common styles for all devices */
}

.description {
  /* Common styles for all devices */
}

/* Media query for mobile devices */
@media (max-width: 767px) {
  .container {
    /* Styles specific to mobile devices */
  }

  .title {
    /* Styles specific to mobile devices */
  }

  .description {
    /* Styles specific to mobile devices */
  }
}

/* Media query for tablet devices */
@media (min-width: 768px) and (max-width: 1023px) {
  .container {
    /* Styles specific to tablet devices */
  }

  .title {
    /* Styles specific to tablet devices */
  }

  .description {
    /* Styles specific to tablet devices */
  }
}

/* Media query for desktop devices */
@media (min-width: 1024px) {
  .container {
    /* Styles specific to desktop devices */
  }

  .title {
    /* Styles specific to desktop devices */
  }

  .description {
    /* Styles specific to desktop devices */
  }
}

In the above example, we have a container with a title and a description. We define different styles for mobile, tablet, and desktop devices using media queries:

  1. Media query for mobile devices:

    • The @media (max-width: 767px) media query targets screens with a maximum width of 767 pixels, typically representing mobile devices.

    • Within this media query, we define specific styles for the .container, .title, and .description classes to adapt the layout and appearance for mobile devices.

  2. Media query for tablet devices:

    • The @media (min-width: 768px) and (max-width: 1023px) media query targets screens with a width between 768 pixels and 1023 pixels, typically representing tablets.

    • Within this media query, we define specific styles for the .container, .title, and .description classes to adjust the layout and appearance for tablet devices.

  3. Media query for desktop devices:

    • The @media (min-width: 1024px) media query targets screens with a minimum width of 1024 pixels, typically representing desktop devices.

    • Within this media query, we define specific styles for the .container, .title, and .description classes to customize the layout and appearance for desktop devices.

By using media queries and targeting specific device characteristics, you can define different styles for mobile, tablet, and desktop devices, ensuring an optimized and tailored user experience across various devices.

      

Popular Category

Topics for You

HTML

Introduction
Html page 1
Html page 2
Html page3
Html page4

HTML Elements and structure
Html page 5
Html page 6
Html page 7

HTML Headings and Paragraphs
Html page 8
Html page 9
Html page 10

HTML Lists and Tables
Html page 11
Html page 12
Html page 13

HTML Forms and Input Fields
Html page 14
Html page 15
Html page 16

HTML Images and Media
Html page 17
Html page 18

HTML Links and Anchors
Html page 19
Html page 20
Html page 21

HTML Styles and Formatting
Html page 22

HTML Semantic Elements
Html page 23
Html page 24

HTML Attributes
Html page 25
Html page 26

HTML JavaScript Integration
Html page 27
Html page 28
Html page 29
Html page 30

HTML Document and Browser Support
Html page 31
Html page 32

HTML5 New Elements and Attributes
Html page 33
Html page 34
Html page 35
Html page 36

HTML Accessibility and Web Standards
Html page 37
Html page 38
Html page 39

HTML Responsive Design and Mobile Devices.
Html page 40
Html page 41
Html page 42

Go through our study material. Your Job is awaiting.

Recent Posts
Categories