Having trouble with CSS text-align right not functioning properly? Here's how you can fix it

<div style="text-align: left;width: 21cm;">
    <h4 style="text-align: center;font-weight: bold;font-size: 20px;margin: 0">Tax Invoice(Center) <span style="text-align: right;"> For Customer(Right)</span></h4>
</div>

I need to align the text

For Customer(Right)

To be aligned on the right side, but it currently displays in the center. How can I adjust it to show on the right side?

Answer №1

A different option to consider

.header-line {
  width:100%;
  background:#eee;
}
.head-33 {
  display:inline-block;
  width:33.3%;
  line-height:48px;
  font-size:1em;
  font-weight:bold;
  text-align:center;
}
<!-- Please make sure open div is right next to the 
     preceding close div -->
<div class="header-line"><div
  class="head-33">Left</div><div
  class="head-33" style="background:#efe">Center</div><div
  class="head-33">Right</div></div>

Answer №2

<div style="text-align: left;width: 21cm;">
    <h4 style="text-align: center;font-weight: bold;font-size: 20px;margin: 0">Tax Invoice(Center) <span style="float: right;"> For Client(Right)</span></h4>
</div>

Utilize the float: right; property to achieve the desired result

Answer №3

Give this a shot

<div style="display: flex; justify-content: space-between;width: 21cm;margin:auto">
  <span style="text-align: center;width:100%">Invoice Receipt(Centered)</span><span style="white-space: nowrap">For Customer(Right-aligned)</span>
</div>

Answer №4

Transform the following:

<div style="text-align: right;"> For Customer(Right)</div>

This adjustment will give you the desired outcome.

Answer №5

Invoice for Tax Matters(Centered) For Customer(Right)

<div<  style="text-align: left;width: 21cm;">
    <h4 style="text-align: center;font-weight: bold;font-size: 20px;margin: 0">Invoice for Tax Matters(Centered) <span style="float: right;"> For Customer(Right)</span></h4>
</div>

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

Retrieving API Data in React Using the MERN Stack

Can anyone help me understand why I'm logging an empty array [] in my console even though I'm getting results from my API? This is my Node.js code: app.get("/todos", async (req, res) => { const todos = await todo.find() res.json(todos ...

Importing an external JSON file into a ChartJs chart

As a newcomer to using libraries for drawing charts in JavaScript, I recently started playing around with Chartjs. However, I'm having trouble figuring out how to use getJson or any other method to load my json object and update the labels and data. I ...

HTML: Understanding relative pathsIn this guide, we will

Is there a way to link from thispage.html to thatpage.css using a relative path? public_html ├── folder1 | |__subfolder | |__thatpage.css ├── folder2 │ |__subfolder | |__thispage.html I attempted the follo ...

How come the default is operating when the number is specifically set to 1?

let spans = document.querySelector(`#spans`); let hrs = document.querySelector(`#hrs`); let mins = document.querySelector(`#mins`); let secs = document.querySelector(`#secs`); let start = document.querySelector(`#start`); let stop = document.querySelector( ...

Storing data securely with Firebase: Executing the task 'uploadBytes'

I am currently learning how to use Firestore for my database. I have been trying to send data from state to the database, but I keep encountering an error message that says "uploadBytes" cannot be performed on a root reference. Since I am not very familiar ...

Trouble Aligning Bootstrap Dropdown Menu Link with Other Navbar Links

Issue with dropdown links not aligning properly in the Bootstrap navbar. The positioning seems off and can be seen in the screenshot provided where the blue outline represents the ".dropdown" https://i.stack.imgur.com/QmG7v.png Facing a similar problem a ...

Guide to correcting Form Data errors with XHR resulting in a 400 Bad Request

This is a straightforward piece of code I've written. It's simply a POST request to my API endpoint using FormData. Interestingly, the API is returning a bad request error for reasons unknown to me. When I tested the API with curl, everything wo ...

Verify if the term is present in an external JSON file

I am currently using tag-it to allow users to create tags for their posts. At the moment, users can type any word, but I have a list of prohibited words stored in JSON format. I am looking for a way to integrate this list into the tagit plugin so that if ...

Add slides in PowerPoint before or after the currently selected slide to enhance your presentation flow

I'm currently working on a function that pulls data from an API to convert PowerPoint presentations into base64 strings. Once I receive the response object, my goal is to seamlessly insert the slides into the existing presentation, exactly after the s ...

Customize Bootstrap 5: Changing the default color scheme

Currently, I am utilizing Bootstrap 5 (v5.2.1) along with a form on my website. I am attempting to customize the default styles for form validation. Specifically, I want to modify the colored 'tick' or 'check' icon that is displayed wh ...

Utilizing ThreeJS: Implementing a Sprite in Conjunction with the OculusRiftEffect

I am currently working on a project for the OculusRift using the OculusRiftEffect found at https://github.com/mrdoob/three.js/blob/master/examples/js/effects/OculusRiftEffect.js and incorporating Sprites into the design. However, I am facing an issue where ...

Deliver a universal Angular application using NodeJS and ExpressJS for the server-side functionality

I have set up a Node/Express JS back-end on an AWS instance using a Linux image, along with NGINX as the web server. Currently, my MEAN application is running smoothly as I work on building the Angular application. I copy the dist folder to the Node/Expres ...

Troubleshooting problem with Angular 2 in Internet Explorer related to the use of [style]="

I've encountered a challenge while using angular 2 (2.0.0-beta.17). The app works perfectly on most browsers, but as expected, IE 11 is causing trouble. The scripts included in the head for angular are: <script type='text/javascript' sr ...

Lock GridView headers when only scrolling vertically

I am facing an issue with my gridview on an aspx page. The gridview is wider than the page itself, so I want the headers of the gridview to scroll horizontally along with the content, while remaining fixed vertically. Can anyone help me achieve this? I hav ...

Tips for altering the color of spans that share a common top position without affecting the surrounding sibling elements above or below

Is there a way to change the color of spans with the same top position, excluding sibling elements above or below, in a paragraph made up of spans? I've been working on how to change the color of the line of span tags that contain another span with t ...

What is the correct way to cite an inner class?

Exploring the world of Material UI styling for the first and probably last time, I find myself in a bit of a bind. In my current code setup, I have a question regarding the following structure: .map(section => ( <Section className={classNames(clas ...

Tips for incorporating validation/restrictions into react-datepicker

I've been working on implementing restriction and validation in a react-datepicker component. I'm utilizing redux-form for validation and normalization purposes. Issue: I've noticed that neither the normalizing function nor the validation f ...

Tips for showing legend symbols within tooltips on Highcharts

I've encountered an issue with Highcharts that I need help with. In my Highcharts chart, I'm trying to transfer the symbol from the legend to the tooltip. I'm tackling this challenge in two scenarios: Lines: I have two series, one with a ...

Redis data retrieval is successful on the second attempt

I am utilizing a Redis database along with express routing to create an API. My stack includes node.js and ioredis as well. The process involves connecting to Redis, fetching keys related to a specific date, and then retrieving the data associated with th ...

Fulfill all of the promises within Bluebird, as well as decline any that do

I am in search of a method to retrieve both successful resolutions and rejections from a promise array. I am relying on the Bluebird implementation, so any ES6 compatible solution would be preferable. One option that comes to mind is utilizing Bluebird&ap ...