콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
136 화면

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.

아바타
취소
관련 게시물 답글 화면 활동
1
2월 25
645
0
2월 25
692
1
2월 24
1969
0
12월 23
1970
0
8월 22
3493