Skip to content Skip to sidebar Skip to footer

Correctly Styling Css For Mobile View?

How I'm presently styling all my elements: #pandora { position: absolute; top: 63%; left: 51.5%; width: 9%; } #tidal { position: absolute; top: 68%; left: 40.5%; w

Solution 1:

Follow the following link for practicing of bootstrap.

https://www.w3schools.com/bootstrap/bootstrap_grid_system.asp

For a responsive website, you need to learn the grid system of a bootstrap. It is the most important part of bootstrap. Grid system makes your layout of system responsive.

But, there is a need of media queries also. Some times your internal data does not look good either it is in the responsive layout. For that time you need to use media queries for designing a better-looking website.

Following are some media queries, you can put your CSS code according to device size.

<style>

/* Extra small devices (phones, 600px and down) */@mediaonly screen and (max-width: 600px) {  

   /* Your CSS Code for this device size */    

  }

/* Small devices (portrait tablets and large phones, 600px and up) */@mediaonly screen and (min-width: 600px) {  

   /* Your CSS Code for this device size */    

}

/* Medium devices (landscape tablets, 768px and up) */@mediaonly screen and (min-width: 768px) {  

   /* Your CSS Code for this device size */    

} 

/* Large devices (laptops/desktops, 992px and up) */@mediaonly screen and (min-width: 992px) {  

   /* Your CSS Code for this device size */    

}      

/* Extra large devices (large laptops and desktops, 1200px and up) */@mediaonly screen and (min-width: 1200px) {

   /* Your CSS Code for this device size */ 

}

/* According to Mobile Orientation */@mediaonly screen and (orientation: landscape) {   

   /* Your CSS Code for this device orientation */    

}

Solution 2:

Firstly, use bootstrap grid system (col-md-*) to set your elements to scale between large & small screens. If you need any styling to be done only for mobile view or if you need to override the existing CSS properties for mobile the refer to media-queries.

References:

@mediaonly screen and (max-width: 767px) {  
   /* CSS for mobile view goes in this media query*/#spotify-player {
     position: absolute;
     top: 75%;
     left: 34.5%;
   }
    
   #apple {
     position: absolute;
     top: 65.8%;
     left: 46%;
     width: 4%;
   }
}

Post a Comment for "Correctly Styling Css For Mobile View?"