Even though I have read numerous similar questions on the topic, I am still struggling to understand how to position divs or other elements based on different media.
Here's my issue: I have a div containing 4 social bar pictures that I want to make responsive across all devices, especially mobile.
If anyone is willing to guide me through the process step by step, I would greatly appreciate it.
My current code looks like this:
HTML
<div class="col-sm-5" id="social-bar">
<div class="pic1"></div>
<div class="pic2"></div>
<div class="pic3"></div>
<div class="pic4"></div>
</div>
CSS
#social-bar
{
float:left;
display: inline-flex;
margin-top: 60px;
}
.pic1
{
background: url('../image/facebook.png') no-repeat;
width:29px;
height:27px;
margin-left: 180px;
}
.pic2
{
background: url('../image/twitter.png') no-repeat;
width:29px;
height:27px;
margin-left: 20px;
}
.pic3
{
background: url('../image/instagram.png') no-repeat;
width:29px;
height:27px;
margin-left: 20px;
}
.pic4
{
background: url('../image/gmail.png') no-repeat;
width:29px;
height:27px;
margin-left: 20px;
}
I have attempted the following so far, but it's not working as expected
@media screen and (max-width: 350px){
.pic1{
background: url('../image/facebook.png');
}
}
@media screen and (max-width: 350px){
.pic2{
background: url('../image/twitter.png');
}
}
@media screen and (max-width: 350px){
.pic3{
background: url('../image/instagram.png');
}
}
@media screen and (max-width: 350px){
.pic4{
background: url('../image/gmail.png');
}
}
This is the current positioning of the social bar
https://i.sstatic.net/yB1X4.jpg Any suggestions or feedback would be highly appreciated. Thank you!