Jump to content

Fieldset legend align attribute works in preview but not in actual post


Dybrar

Recommended Posts

The title pretty much says it all. If you manually add the align="right" attribute to a fieldset legend element, the legend will be aligned correctly to the right in the preview window, but it'll be back in its default position on the left when the post is made or the edit saved (and the aforementioned attribute will have been entirely discarded from the HTML source).

Link to comment
Share on other sites

31 minutes ago, Dybrar said:

The title pretty much says it all. If you manually add the align="right" attribute to a fieldset legend element, the legend will be aligned correctly to the right in the preview window, but it'll be back in its default position on the left when the post is made or the edit saved (and the aforementioned attribute will have been entirely discarded from the HTML source).

Let me try floating it....

Titbbbble

ContentTest


Won't float either.

Link to comment
Share on other sites

Right

This way

Add the following style to the <legend>:

style="text-align: right;"

The align attribute is not part of the HTML standard for legend and not all browsers support it, so it's removed by the sanitizer.

Link to comment
Share on other sites

Unfortunately, text-align does not work consistently across browsers either; Firefox 125.0.2 ignores it, but Safari on iPadOS 17.4 and Chrome 124.0.6367.79 render it as intended. I suppose I'll just have to live with that. Thanks!

Link to comment
Share on other sites

10 minutes ago, Dybrar said:

Unfortunately, text-align does not work consistently across browsers either; Firefox 125.0.2 ignores it, but Safari on iPadOS 17.4 and Chrome 124.0.6367.79 render it as intended. I suppose I'll just have to live with that. Thanks!

Alternate approach:

style="margin: 0 0 0 auto;"

 

Link to comment
Share on other sites

That does work! I am a little embarrassed that I failed to think that myself as I've spent the past couple of days trying to finesse post layouts chiefly by way of padding/margin shenanigans, but I'll take it all the same. Cheers!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...