Strange behaviour (text color, align not working)

Need help with the Administration of your Joomla! 3.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
Jombeasty
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed May 17, 2023 3:50 pm

Strange behaviour (text color, align not working)

Post by Jombeasty » Sat May 27, 2023 2:08 pm

Hello dear community!

Please help me with advice. Somehow, I dont know why, but articles editors doesnt edit my code! Im trying to color the text but on page - no result! Text - the same! Fore example (code frome editor)<p style="text-align: left;">text text <span style="background-color: #ff0000;">text</span> text again! text</p>
<p style="text-align: left;">text</p>
<p>&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p>&nbsp;</p>

Tell me, why it happens?

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1578
Joined: Tue Jun 30, 2020 12:17 pm

Re: Strange behaviour (text color, align not working)

Post by Pavel-ww » Sun May 28, 2023 10:28 am

Jombeasty wrote:
Sat May 27, 2023 2:08 pm
Hello dear community!

Please help me with advice. Somehow, I dont know why, but articles editors doesnt edit my code! Im trying to color the text but on page - no result! Text - the same! Fore example (code frome editor)<p style="text-align: left;">text text <span style="background-color: #ff0000;">text</span> text again! text</p>
<p style="text-align: left;">text</p>
<p>&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p>&nbsp;</p>

Tell me, why it happens?
Hi. Your code is Ok. Use browser dev tools to determine the cause. Without a link to your site, nothing else can be said.

User avatar
xfsgpr
Joomla! Ace
Joomla! Ace
Posts: 1099
Joined: Mon Feb 14, 2011 4:02 am
Location: London

Re: Strange behaviour (text color, align not working)

Post by xfsgpr » Tue May 30, 2023 9:02 pm

Tell me, why it happens?
It happens because you haven't given a width of the text along which to align the text. Try this code and see how it looks in your test environment:

Code: Select all

<p style="text-align: left;width:300px;">Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo tempore cupiditate architecto impedit dignissimos reiciendis, iste eum debitis, nisi nulla tenetur saepe rerum libero aliquam beatae provident exercitationem voluptates suscipit!</p>
    <hr>
    <p style="text-align: center;width:300px;">Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo tempore cupiditate architecto impedit dignissimos reiciendis, iste eum debitis, nisi nulla tenetur saepe rerum libero aliquam beatae provident exercitationem voluptates suscipit!</p>
    <hr>
    <p style="text-align: right;width:300px;">Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo tempore cupiditate architecto impedit dignissimos reiciendis, iste eum debitis, nisi nulla tenetur saepe rerum libero aliquam beatae provident exercitationem voluptates suscipit!</p>
    <hr>
    <p style="text-align: justify;width:300px;">Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo tempore cupiditate architecto impedit dignissimos reiciendis, iste eum debitis, nisi nulla tenetur saepe rerum libero aliquam beatae provident exercitationem voluptates suscipit!</p>

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1578
Joined: Tue Jun 30, 2020 12:17 pm

Re: Strange behaviour (text color, align not working)

Post by Pavel-ww » Wed May 31, 2023 6:47 am

xfsgpr wrote:
Tue May 30, 2023 9:02 pm
It happens because you haven't given a width of the text along which to align the text.
Hi. What does this have to have a width in general? :eek: Have you read OP's question?

The code provided by OP works perfectly without any width property.
1.jpg
--
Research is required through the dev tools to find out why it does not work for OP
You do not have the required permissions to view the files attached to this post.


Post Reply

Return to “Administration Joomla! 3.x”