Footer won't have the option to right align the Span element

I'm having trouble getting my copyright span to align to the right in my footer. Can you help me figure out what I'm doing wrong?

<footer>

    <span>Blog</span><span>Hire</span><span>About</span><span id="copyright">Copyright &copy; 2012 Max Kramer</span>

</footer>

footer {
    width:  50%;
    height: 100%;
    margin-left: auto;
    margin-right: auto;
}

footer span {
    display: inline-block;
}

footer span #copyright{
    text-align: right;
}

Answer №1

Start by eliminating the space between span and its ID as they are the same element, not an ID nested within a span. Second, opt for using float instead of text align :)

footer span#copyright{
  float: right;
}

You can simplify it further:

footer #copyright{
  float: right;
}

No need to specify "inline-block" for spans since that's their default value for "display."

Answer №2

A span is a flowing object, so it does not inherently have a width. In order to assign a width to it, you must turn it into a block element. This will allow you to right-align it. However, changing it to a block element will cause it to be pushed down to the next row below other spans, necessitating the need to float it to the right.

To achieve this, follow these steps:

#copyright {
    text-align: right;
    display: block;
    float: 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

Tips for activating animated text upon hovering over a text or image:

My brand name is: Code The navigation bar displays as follows: Code Home | Service | Product | Contact I would like to change the appearance of my brand name from Code to { Code } when users hover over it. Additionally, I wish to style the brackets { ...

Javascript is not functioning properly when making an ajax call

Having a bit of trouble with JavaScript not working after an Ajax call. Everything functions normally until new data is fetched from the database or an Ajax call is made. The issue seems to be that the JavaScript doesn't load properly. Any help would ...

Step-by-step guide to layering two divs within a table cell

Here is the code I am working with: <td class="mobile-user-icon"> <span class="mobile-photo">background text</span> <span class="mobile-caller-mute">overlay text</span> </td> .mobile-user-icon { width: 64px ...

What is the proper usage of main.js and main.css within the skeleton portlet project that is created by the Liferay 6.0.6 plugin SDK?

Is it a good practice to include portlet-specific JS or CSS in them only if <portlet:namespace /> works within them? Should I rely on unique function/variable names or class names instead? ...

Tips for Adjusting the Position of a DIV Element Slightly Upwards

I am having trouble positioning the home-link image in my hovering navigation bar. The URL to my blog is: . Ideally, I want the image to be aligned with the text tabs next to it, but no matter what I try, I can't seem to move the "home" icon up by abo ...

Adding an HTML element to the DOM in an AngularJS directive without using jQuery

Looking to enhance my AngularJS directive by including an svg tag within the current element, currently using jQuery for this purpose. link: function (scope, iElement, iAttrs) { var svgTag = $('<svg width="600" height="100" class="svg">< ...

What is the best way to arrange multiple elements on the second row within a div?

As I attempt to utilize CSS for positioning elements within a div, my challenge lies in the limitation of only being able to use classes/ids due to the fact that the div and its content are generated from a third-party plug-in (datatables). This restricts ...

Steps for making a button with both an image and text:

I am in the process of designing a basketball-themed website and I am looking to incorporate custom icons/buttons that link to various pages on the site. My vision is to have a unique button that features a circular image with accompanying text below it. ...

Is it possible to refresh a table that is currently displayed in a model popup?

My code to reload a table or div inside a model popup continuously is not working as expected. Can you help me with this issue? I attempted to utilize ajax for this purpose but unfortunately, the code below is not updating chats (I am working on a chat ta ...

Content hidden by spoiler buttons may overlap with other spoiler buttons

I've created some spoilers that reveal information when clicked on. When I clicked on spoiler1, the content slid underneath the other spoilers strangely. Here's an example of what happened: http://gyazo.com/4571423534e2442dc960d119c668dfa8 Why ...

The image is not correctly aligned in the center within the anchor element

In the process of working on my Angular project, I have encountered an issue with displaying components as items. Here is a snippet of the component code: <a href="" class="list-group-item clearfix" > <div class="container-fluid"> <div class ...

What's the best way to make sure all the data fits neatly within the confines of the table?

Is there a way to ensure that all the information remains within the table without using the style="overflow:scroll" property? Here is an image of the table overflowing to the right in the middle of the LATEST DATE CHECKED column. Here is the c ...

The Angular framework seems to be causing a problem with a Bootstrap column that is supposed to fill 100% of the width

I am currently working on a page that consists of a side navigation bar and a content area. Here is a basic representation of its layout: https://i.sstatic.net/XcPQL.png [https://jsfiddle.net/hd46twu1/6/][2] While redeveloping the same application using ...

creating styles for css elements using equations

I am curious about defining CSS element dimensions before they are rendered without using offset and jQuery. Is it possible to echo PHP into the width/height or position values? For example: <?php $width = 290px; $altwidth = 290; ?> <style> ...

Is there a way to confirm if an element's predecessor includes a specific type?

I am working on an app where I need to determine if the element I click on, or its parent, grandparent, etc., is of a specific type (e.g. button). This is important because I want to trigger a side effect only if the clicked element does not have the desir ...

Is it possible to adjust the position of a h2 heading on a particular webpage using CSS?

There is a situation where multiple pages contain h elements nested inside a standard container div class. When trying to edit a specific h2 element in a specific page using CSS, simply editing the h2 or the container does not work. Other methods attempte ...

Retrieve information from a database based on user input keywords utilizing PHP and SQL

I have been exploring ways to allow users to enter keywords via HTML forms and then use this information to retrieve the relevant data from a database using PHP and SQL. So far, I have only been able to display data from the database using a static SQL qu ...

Is there a method to deactivate multiple form elements simultaneously?

My goal is to deactivate a specific section of HTML form elements based on certain conditions. I initially tried using the following method: <fieldset disabled> <input value="one" /> <input value="two" /> </fie ...

Trouble with Updating InnerHTML

xmlHttp = new XMLHttpRequest(); xmlHttp.open( "GET", "myurlhere.php", true ); xmlHttp.send(); var display = document.getElementById("display"); display.innerHTML = xmlHttp.response; This snippet of code is part of a function triggered by a button click. ...

Having trouble grasping the display property combination in Bootstrap4

Incorporating Bootstrap4 into my web application, I am faced with the task of displaying a menu exclusively on the large screen size setting (lg). The guidelines are straightforward: utilize a class to conceal an element across all screen sizes: .d-none ...