I'm hoping that this question can be a jumping point for helping me understand responsive design. Consider a header on a typical desktop screen. I have a div that will contain the information I want to display:
.hdrinfo{
width: 51%;
margin: 0 auto;
display: flex;
flex-direction: row;
}
When the div is displayed on a tablet I want the width to be at 75% and on a smartphone I want the div at 100%. I've made many attempts at media queries to facilitate this base on the numerous, numerous articles I've read - to my frustration. Can someone point me in the right direction?
UPDATE: I've edited the CSS to make is move obvious (at least to me) on whether or not the queries are working:
.hdrcntr{
width: 52%;
height: 100%;
margin: 0 auto;
background: green;
}
@media only screen and (max-width:992px){
.hdrcntr{
width: 75%;
background: steelblue;
}
}
@media only screen and (max-width:412px){
.hdrcntr{
width: 100%;
background: tomato;
}
}
My logic is that the background defaults to green
. On an iPad the background is steelblue
and on my Samsung S8+ the background is tomato
.
This logic works for both the desktop and the iPad; however, despite the official Samsung spec of (360x740) and two other websites that claim (412x846) I cannot get the S8 to display correctly (shows steelblue).