Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
133 มุมมอง

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)

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.พ. 25
644
0
ก.พ. 25
691
1
ก.พ. 24
1969
0
ธ.ค. 23
1969
0
ส.ค. 22
3491