How can I align text in the center of a page and on the same line as a list?

Take a look at my website:

I've been struggling to center the text on the screen with the social icons floating to the right. Here's the code I have:

Code -

<div class='social_icons'>          
         <span class="social_icons_user"> Not already a user? <a class="signup2" href="register.php">Sign up here!</a>  
            <ul class="social_icons_ul">
                <li><a href="http://facebook.com/Budgie.SocialDiscussion"><img src="Images/facebook.png" alt="Facebook" width="16" height="16"></a></li>        
                <li><a href="https://profiles.google.com/u/0/112265357246183728158"><img src="Images/google.png" alt="Google" width="16" height="16"></a></li>              <li><a href="http://twitter.com/Budgie_SD"><img src="Images/twitter.png" alt="Twitter" width="16" height="16"></a></li> 
            </ul>               
          </span> 

</div>

CSS

.social_icons{
    height:50px;
    width:800px;
    background-color:#10260F;
    font-size:12px;
    margin-left:auto;
    margin-right:auto;      
    margin-top:10px;
    color:#FFF;
    background-color:red;
    margin-bottom:10px;
}

.social_icons_user{     
    display:block;
    text-align:center;
    background-color:black; 
}

.social_icons_ul{       
    float:right;
}

.social_icons_ul li{
    display:inline;     
}

Answer №1

.social_media_icons {
position: absolute;
right: 0px;
top: 0px;
}

.social_media_user {
display: block;
text-align: center;
background-color: black;
position: relative;
}

hey, you found it!

Answer №2

Greetings! It's quite simple to define in your CSS:

CSS Code

  .social_icons{
    height:50px;
    width:800px;
    background-color:#10260F;
    font-size:12px;
    margin-left:auto;
    margin-right:auto;      
    margin-top:10px;
    color:#FFF;
    background-color:red;
    margin-bottom:10px;
}

.social_icons_user{     
    display:block;
    text-align:center;
    background-color:black;
}

.social_icons_ul{       
    float:right;
}

.social_icons_ul li{
    display:inline;     
}

Your HTML Code Below

<div class='social_icons'>          
         <span class="social_icons_user"> Not already a user? <a class="signup2" href="register.php">Sign up here!</a>  
            <ul class="social_icons_ul">
                <li><a href="http://facebook.com/Budgie.SocialDiscussion"><img src="Images/facebook.png" alt="Facebook" width="16" height="16"></a></li>        
                <li><a href="https://profiles.google.com/u/0/112265357246183728158"><img src="Images/google.png" alt="Google" width="16" height="16"></a></li>              <li><a href="http://twitter.com/Budgie_SD"><img src="Images/twitter.png" alt="Twitter" width="16" height="16"></a></li>
            </ul>               
          </span>

</div>

Feel free to view the live demo here for testing.

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

The mobile version of my website's home page is not displaying certain elements of the featured image

I'm in the process of launching a fresh new blog with Flask as the backend. Currently, I'm using a Bootstrap template and have set an image as the featured image. While it displays properly on computers, tablets crop it out. You can check out the ...

Can a container be sized based only on the width of one of its children?

Take a look at this snippet of html: <div class="container> <div class="header"> </div> <div class="content"> </div> <div class="footer"> </div> </div> I am aiming for the containe ...

Encountered a SyntaxError stating 'Unable to use import statement outside a module' while attempting to utilize three.js

I'm facing difficulties with incorporating three.js into my project. Initially, I executed: I am referring to the guidelines provided here: In my VS Code terminal for the project folder, I ran the following command: npm install --save three Subsequ ...

Issue with MVC Bundle not functioning properly in Release Configuration due to Debug being set to False, causing CSS and JS files to not

Whenever I deploy my MVC.Net application in release mode, the following configuration will be present in the web.config file: <compilation debug="false" targetFramework="4.5" /> After making the above changes, the site loads with CSS and JavaScript ...

What is the best way to prevent the child elements from inheriting the hover effect of the main container?

Looking to spice up the appearance of the div element that holds the product's image, SKU, and price. Adding a hover effect to the main container causes the child divs to inherit it, resulting in separate hover effects on each child div. Sample HTML ...

Execute code after the CSS has been loaded, but before the images start downloading

My website is experiencing a challenge. Downloading images is taking too long, with the complete website taking around 20 seconds to fully load on my system. A loader is displayed but only hides once the complete website is loaded (after 20 seconds). Whe ...

Bootstrap does not support horizontal alignment of columns

I can't seem to get my columns to align horizontally in bootstrap. I want the image on the left and the text on the right, but they keep stacking vertically. Can someone help me with this? As far as I know, col-md-6 should divide the page into 2 colu ...

Using JWPlayer 6 and JWPlayer 7 simultaneously in one project - how is it done?

Trying to incorporate both JWPlayer 6 and JWPlayer 7 into my expressJS, AngularJS project has been a challenge. While they each work independently without issue, bringing them together has proven to be tricky. In my index.html file, I include them separat ...

The icons from Materialize CSS are not displaying properly in the Safari web browser

It has come to my attention that the icons in Materialized CSS are not displaying properly in Safari (v5.1.7). Despite conducting thorough research on this issue, I have been unable to find any documentation regarding browser compatibility with Safari. Can ...

utilize a modal button in Angular to showcase images

I am working on a project where I want to display images upon clicking a button. How can I set up the openModal() method to achieve this functionality? The images will be fetched from the assets directory and will change depending on the choice made (B1, ...

Changing classes within Twitter Bootstrap 3 causes a shift in style and layout

Currently, I am working with Twitter Bootstrap 3 and have a DIV that contains either an image or video. The div has a col-sm-3 class, but when hovering over it, I use jQuery to switch it to a col-sm-12. I am wondering if there is a way to create a smooth ...

Clicking on the accordion twice does not alter the position of the arrow

I have implemented an accordion using "up" and "down" arrows. It works well, but when I click on the panel title again, the arrow does not change direction. Here is the issue: In my scenario, I have used "A" and "B" instead of the arrows. When the page l ...

Navigate to the following section on an HTML page by clicking a button using jQuery

Within my application using Jquery / Javascript, I am looking to implement a specific functionality. I currently have several div elements like the ones below: <div id="div1"></div> <div id="div2"></div> <div id="div3"></ ...

What is the process for submitting $_POST data using a form?

Hey there, I'm currently facing an issue with sending an ID in a form. The structure of my website looks something like this: session_start(); if (!isset($_SESSION['a'])){ ...create the session from some variables... $_SESSION['a& ...

manipulate and update dynamic data in a repeated input field in a v-for loop

I am facing an issue with updating the value of a property within an object in a Vue instance using the v-model directive. The object is dynamically populated when a user clicks a button, and I have a v-for loop that displays the properties of the object a ...

How many divs are present within a single parent div using selenium?

Could someone help me with counting the number of divs inside a specific div using selenium? https://i.sstatic.net/eyWIC.png I'm currently using this code to achieve that, but for some reason it's not returning the correct length. Instead, it s ...

CSS layout with percentage values breaks when viewed on iPad

Currently, I am in the process of developing a website according to a client's requirements. The site works perfectly on OSX Safari, Firefox, and Chrome but has not been tested on PC yet. However, it breaks quickly when accessed on an iPad and is comp ...

mobile-friendly sticky footer

Currently working on a website project utilizing Bootstrap 3 (http://www.patrickmanser.ch/fnws) and I am trying to implement a sticky footer. After adapting the code snippets from Bootstrap 3 examples according to my specifications, everything seems to fun ...

Rows in a table materialize and fade away

Why does the row show for less than one second and then disappear when I click on the button? Everything works fine when I delete the form tag. How can I make it work without having to delete the form tag? Check out the code below: <html> <head ...

Ways to elegantly re-establish a websocket connection?

I've been working on a single-page application that utilizes HTTP and Websockets. When the user submits a form, I start streaming a response back to the client. Here's a snippet of the client-side code: var html = `<!DOCTYPE html> <met ...