The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Right align part of sentence
denmarks
post Sep 15 2021, 12:34 PM
Post #1


Advanced Member
****

Group: Members
Posts: 207
Joined: 17-January 08
Member No.: 4,734



How do a right align part of a sentence?

City name date time

I want "City name" to stay left but I want "date time" to tab and right align. I know I can add non breaking spaces but that is too much trouble and breaks if I widen the containing space.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Sep 15 2021, 12:50 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



If it's a table row I'd use two cells.

If it's a complete sentence, maybe you could float the two parts left and right.

If it's just a part of a sentence, please post a complete example because then I don't understand. laugh.gif

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
denmarks
post Sep 15 2021, 12:52 PM
Post #3


Advanced Member
****

Group: Members
Posts: 207
Joined: 17-January 08
Member No.: 4,734



I figured it out. I used float: right.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Sep 15 2021, 06:17 PM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



Actually, if it is a table and different cells, you can just align the parts left and right with text-align: left and right. Same goes if they are in different block level boxes, like P or DIV.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Sep 15 2021, 06:21 PM
Post #5


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



QUOTE(pandy @ Sep 16 2021, 01:17 AM) *

Same goes if they are in different block level boxes, like P or DIV.

Then you also need to make the block level elements appear on the same line, with e.g.:

CODE
display: inline-block; width: 50%;
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 02:31 PM