简体   繁体   中英

HTML Tags in Resource File Showing as Plain Text

I'm trying to bold a few words in a "Consent" string stored in a resource file to be displayed in a read-only, scrollable textbox on a web page. I tried putting in the bold tags-- <b></b> -- but they would show up as plain text in the "Consent" string when the web page is run.

Since there were other strings stored in the same resource file using the break tag-- <br /> -- I thought I would try putting one in this "Consent" string. This break tag, that works and inserts a new line for all the other strings in the same resource file, shows up as plain text again in this "Consent" string.

I thought it may be a css style override, but I don't think there is a css class referring to the textbox containing this string.

This is a split view of the textbox containing the "Consent" string

This is a part of the "Consent" string I tried to bold: We are collecting responses to this assessment for <b>research purposes only</b>.

ps. this is someone else's code that I was given to manipulate and learn from.

Assuming your text box is an <input> or <textarea> , this is expected behavior - these elements don't support rich content out of the box. You likely want to change that to a <div> or <span> with a height and width set to that of your expected text box dimensions, probably with overflow: auto; so it will still show scroll bars if the content goes beyond its set height and width. It can also be styled with the appropriate background/border/etc. to look like a text box.

Alternatively, if you are trying to make the entire element bold, you can style the element such (eg setting font-weight: bold; on it).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM