Mobile devices will display social icons in the center, while desktops will show them on the right side

Can someone help me with organizing my social icons on my website? I want them to be centered when viewing the site on mobile and aligned to the right on desktop.

The Issue: Currently, the icons are aligning to the left and then centering on mobile. I can't seem to make them align to the right instead of the left.

Here is the HTML code:

<div class="soimg">
    <div class="images">
        <img src="social/facebook.png"/>
        <img src="social/insta.png"/>
        <img src="social/twitter.png"/>
        <img src="social/youtube.png"/>
    </div>
</div>


CSS: 


.soimg img {
    height:30px;
    width: auto;
    margin-right: 5px;
    display: inline-block;
    filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 3.5+ */
    filter: gray; /* IE6-9 */
    -webkit-filter: grayscale(100%);
    opacity: 0.4;
    text-align: right;
}

.soimg img:hover {
    filter: none;
    -webkit-filter: grayscale(0%);
    opacity: 1;
}

.images {
    height:50px;
    background-color:#1c1c1c;
    margin-top: -20px;
    margin-bottom: -20px;
}  
@media screen and (max-width:700px) {
    .soimg {
        margin-left: auto;
        margin-right: auto;
        text-align: center;
    }
}

Answer №1

Make sure to define the text-align:right property, as it is not set by default.

.soimg {
    text-align: right;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Enhance iOs performance by optimizing animations using CSS3 and jQuery

As I gear up to develop a webapp, I've encountered some issues with animating objects using jQuery or CSS3. The animations appear sluggish and lack fluidity, much like they do on my computer or the iOS Simulator. I suspect that this may be due to the ...

Having trouble with the speed of multiple jQuery posts?

We have encountered some challenges with calling multiple jQuery posts since switching to our new server. On certain pages, we are making multiple jQuery post requests as shown below: $.ajax({ type: "POST", url: "../files/processed/includes/proce ...

Converting HTML to PDF using JavaScript

My goal is to create an HTML page and then print and download it locally as a PDF. However, when I try to generate the PDF, it cuts off the last 3 to 4 lines of the page. I want to create multiple PDF pages in A4 size with the same styling as the HTML pa ...

What are the steps to set up Twitter Bootstrap without using offset blocks?

I am currently setting variable values using AngularJS. <div class="col-md-5">Cost:</div> <div class="col-md-7">{{ cost }}</div> <div class="col-md-5">Total:</div> <div class="col-md-7">{{ total }}</div> Af ...

Validating group radio buttons that have been checked

I possess: <div class="group"> <input type="radio" name="myradio" value="1">a <input type="radio" name="myradio" value="2">b </div> <div class="group"> <input type="radio" name="two" value="3">a <input ty ...

The uncomplicated bar graph and its corresponding axis line up perfectly beside each other in an SVG diagram

I'm currently working on a stacked bar chart in my CodePen project found here: https://codepen.io/a166617/pen/qBXvzQd However, I am facing an issue where the graph is not aligned properly with the x-axis and y-axis lines. The barchart seems to be sli ...

Element within grid not stretching to full width

My experience with using grid is still quite fresh. Although I've completed a few projects, I'm struggling with some issues. One of them involves setting the grid element to 100%, but it seems to be getting clipped at 80%. It appears like such a ...

What is the origin of the character?

Currently running a string test. When I obtain the innerHTML, there are unexpected u'\n and \n', AssertionError: u'\n<p><strong>The user/password code entered is incorrect!</strong></p>\n' != ...

Incorporating PHP into Dynamic Variables

I'm curious about how PHP coding can be utilized in PHP variables. Let's say, for instance, I wish to achieve something like: $Start = " IF($lala == "0"){ echo '"; $End = " '; }"; and be able to utilize it as: echo ''.$star ...

Pulling Specific HTML Element from External Website with PHP

<?php $info = file_get_contents('http://examplewebsite.com/data'); echo $info; ?> I am trying to extract specific information from a remote website using PHP, focusing only on certain tags. While I have found a script that allows me t ...

Achieving Full Height in CSS with Multiple Nested and Floated Divs

I am currently working on a layout with multiple nested Divs, and I am trying to make the content areas stretch to fit the height of the screen. While I have done this before, I am facing some challenges with it in this particular layout. Instead of sharin ...

Locate the hyperlink within a div using JavaScript and navigate to it

I stumbled upon an element (div1) and now I am looking for a link within that element (link) so that I can navigate to it. <div class="div1"> <p> <a href="link">Link</a> </p> </div> ...

Is it achievable to have a background image cover size with a responsive rollover effect?

I’m currently facing a unique challenge where I want to have an image as the background of my website, with the size set to cover the entire screen. On this background image, there are elements like buildings that I want to interact with when hovered ove ...

displaying the information when we mouse over a specific row in the table

I need to display a pop-up with data from a table row, similar to the image at this URL for CS WHOLESALE GROCERS. I've implemented the following AngularJS code in my controller: app.directive('tooltip', function(){ return { res ...

Dynamic URL Routing in Django

I am attempting to display content within a movie poster using a dynamic URL, but I am encountering an issue with my code. The purpose of my code is to create a simple webpage that showcases multiple movie posters. When a user clicks on a specific poster, ...

Semantic UI allows for both left and right action input functionalities to be utilized

Is there a way to add actions on both ends of an input field? Here's what I've tried so far: <form class="ui form"> <div class="ui left action input"> <select class="ui compact selection dropdown" name="seats"> ...

Create a CSS effect where a transparent image appears when hovering over an element

Does anyone know how to overlay a transparent image on hover using CSS in IE7 or IE8? I found an answer here, but it doesn't work for these browsers. I'd like to keep it super-light, so I'm trying to avoid using JavaScript or anything simil ...

Aligning text to the center and having it displayed on either side of it

Hey there, I need help with the following: <div id='1'></div> <div id='2'></div> <div id='3'></div> I want to place a single word into each div. The width of each div should be ...

What is the best way to incorporate custom CSS into an angular-fullstack application?

I'm interested in incorporating an image into a jumbotron and adjusting its width correctly, similar to what was discussed in this question: Bootstrap image to jumbotron width However, I am unsure of where to place my custom CSS code to achieve the d ...

HTML code containing a dropdown menu with selectable options pulled from a Django framework

Here is the HTML code snippet I am working with: <select name="txn" tabindex="3" id="txn" class="fixed" onfocus="highlightInput(this.id)" onblur="unhighlightInput(this.id)"> <option value="RR" my="{{txn|genselected:"RR"|safe}>RR</option ...