Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
132 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
1
Feb 25
644
0
Feb 25
691
1
Feb 24
1969
0
Des 23
1969
0
Agu 22
3490