开发者

embeded google translate with pre tag problem

开发者 https://www.devze.com 2023-01-29 19:49 出处:网络
The google translate that you actually embed on your page... http://translate.google.com/translate_tools

The google translate that you actually embed on your page...

http://translate.google.com/translate_tools

If you have a page with a <pre></pre> tag it combines everything in the pre into one line.

Does anyone know a fix for this?

I looked at the source code but that is still showing the original page. The actual translated stuff is only showing on the screen (like it was appeneded later or something?).

Can I do something with javascript or css? Like change the t开发者_开发问答ype of font used in the pre tag?

Sample page:

http://www.gootab.com/b/beatles/dear_prudence.tab.php?translate

go there then change dropdown to russian.


I'd suggest avoiding the <pre> tag.

You are using <pre> tags to format your page (basically setting a font and turning CR/LF into a line break in the client browser). This is considered bad practice.

Since your code is in PHP, you should be able to use a simple statement like nl2br (http://php.net/manual/en/function.nl2br.php) to convert your ASCII text into clean HTML with line breaks. Output it in <code> tag (or <div> or even <pre>, or something else entirely) and use CSS to style it.

0

精彩评论

暂无评论...
验证码 换一张
取 消