10

I'm almost certain that I've seen some post in the Q&A that had, in the same line, some text aligned to the right and some text aligned to the left, kind of like a page header.

I've been looking through the markdown help pages and posts but I'm not being able to find anything, the most I could find was how to align text to the right in a table, but that's all the text, and I would also forego the table.

How is it done?

7
  • 1
    @Anonymous Why? They're seeking support, there's no subjective answer or discussion to be had May 2, 2021 at 22:27
  • 1
    You should've saved a link or two :) Or have you? May 2, 2021 at 22:28
  • @OlegValter not all, the help ones for sure stackoverflow.com/editing-help#headers and daringfireball.net/projects/markdown/syntax
    – anastaciu
    May 2, 2021 at 22:33
  • @anastaciu - no, I mean the posts, of course :) May 2, 2021 at 22:36
  • One coud always make a table with 2 columns and aling one to the right and another to the left (I think that can be done), but I'm sure I've seen this in plain header text.
    – anastaciu
    May 2, 2021 at 22:37
  • 1
    @anastaciu - no worries :) Just curious - not sure if this is possible (apart from obvious spaces of different widths - but those would obviously wrap depending on the screen size) May 2, 2021 at 22:43
  • @OlegValter so far it seems you're right, let's wait, maybe someone appears with a magic trick.
    – anastaciu
    May 3, 2021 at 8:21

3 Answers 3

11

Tables?

left

right

| <h1>left</h1> | <h1>right</h1> |
| :------------ | -------------: |
3
  • 2
    Exactly like this, now... can you remove the table ;)
    – anastaciu
    May 3, 2021 at 8:17
  • 2
    Here it is, the fruit of your work stackoverflow.com/a/67361247/6865932, still think it would look nicer without the table though.
    – anastaciu
    May 3, 2021 at 13:20
  • 2
    What are you talking about, no apologies needed, yours is a great answer, I was just wondering if it's possible, that's all.
    – anastaciu
    May 3, 2021 at 13:33
2

Like                                                                     this?

Like &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; this?
4
  • 11
    Exactly, just like this :) May 3, 2021 at 1:55
  • @OlegValter Yeah didn't expect it to scale well on smaller screens. Fitting one line on full size page
    – charlietfl
    May 3, 2021 at 1:59
  • I know, I had to resize the window to do that :) I think there is no way there could be an in-post responsive title May 3, 2021 at 2:04
  • 3
    @charlietfl, that's the workaround, may it's what I saw, like when people see a bear and think it's a yeti ;)
    – anastaciu
    May 3, 2021 at 8:19
-9

You can also use flex layout with justify-content: space-between:

h1 {
  display: flex;
  justify-content: space-between;
}
<h1><span>Left text</span><span>Right text</span></h1>

4
  • 9
    ehm, I think the question asks about how somebody could achieve this in the body of a post, not as a runnable snippet... May 3, 2021 at 7:27
  • 5
    The programming questions shouldn't be asked on meta and at the same time the snippets are supported on meta. Funny.
    – Sinatr
    May 3, 2021 at 8:18
  • 2
    @Sinatr - hey they are cool for prototyping a proposed feature or making a runnable demo of why one thinks the same feature is a horrible idea :) May 3, 2021 at 8:34
  • seems like you are at the wrong place, this is MetaStackoverflow not stackoverflow Aug 3, 2021 at 2:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .