Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
148 Zobrazení

Hello,

How do I insert a non-breaking space into the text on my web page?

The shortcut ATL+255 produces a space, but it's not non-breaking.

How do I place the code?

Is there a risk it will disappear during an update?

Thanks for your help,

Olivier

Odoo18.0-e (entreprise)

Avatar
Zrušit
Nejlepší odpověď

Hi,

To insert a non-breaking space ( ) in Odoo’s website (QWeb) text, you can use CDATA or numeric entities. For example:

<![CDATA[ &nbsp; ]]>

Or use the numeric Unicode form:

&#160;

These methods ensure the space is preserved when rendering.


Hope it helps

Avatar
Zrušit
Nejlepší odpověď

A no-break space in general is defined as (see first screen for how it is rendered in a browser)

&nbsp;

In this particular scenario, the ampersand & needs to be escaped as well, leading to a final form of (see second screen for how it has to be added in the editor)

 &amp;nbsp;

that will need to be added as described below.


In the example, see the difference between the breaking at/before "veroeoset accusam":


Now, to achieve this, go to the Website Editor, navigate to the Page you need to apply the change to and select Site -> HTML / CSS Editor.
You will find a new sidebar window warning you about potentially loosing changes during an upgrade. This is a generic warning and should not be relevant to the change you perform, since that change is directly related to the content of your web page - thus, 'loosing changes' would also mean loosing the content upon upgrading, which here should not be a thing (unless things go horribly wrong upon upgrading due to other issues).

Continue by clicking Edit HTML anyways, and find the words that must not break in the HTML representation of your web page and remove the 'normal' space with

&amp;nbsp;

like this:


Then, save and close the Editor.


-


Alternatively - and probably easier, you may try to copy the no-break space from https://en.wikipedia.org/wiki/Non-breaking_space#Unicode (the green highlighted text) and paste it directly into your actual content in the 'normal' Website Editor.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
úno 25
647
0
úno 25
711
1
úno 24
1974
0
pro 23
1974
0
srp 22
3500