HTML code displayed in a scroll box
A few readers have asked how to put HTML codes inside a scroll box so that readers can copy the codes to paste it into their own blogs (example see 4 column Minima template. First thing you have to know is that if you try to type the HTML as it is (example), the web browser will interpret that as an instruction to display what follows in a new line (line break) but not display the HTML. What I did to display the above was to type
to display HTML" id="BLOGGER_PHOTO_ID_5250577493689879154" title="special character < > to display HTML" border="0">. In other words, replace < onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio0YiRH4OKWSayV9yK0zbOvvVAvO6iBUCLcUpjQ4ZIDfTOUiZAZXKJJbbG5d7WjQivHAaGIwwkERhR_xDWg7kzFKO7p4HYFr3hBW67ZUsTVf2tYbO7J4DgObRiFUB-kil8W6bihdXAZuE/s1600-h/less+than.jpg">
and replace > with
How to display HTML codes inside scroll box
Now on how to display HTML codes inside a scroll box. First, the script for a scroll box:width: 395px; height: 400px; background-color: a0ffff; color: 000000; font-family: arial; font-size: 12px; text-align: left; border: 0px solid 00000; overflow: auto; padding: 4px;"></div>
I have the script for the scroll box save in a notepad file to be retrieved whenever I need to use it. Now, to explain how I displayed the HTML codes for the scroll box. I paste whatever HTML codes I want to display into a notepad file. Then I click EDIT in the menu bar and select "Replace..." and then type > into the "Find what:" box followed by < into the "Replace with:" box (see screen shot below:
and then click "Replace all". Notepad will find all the < onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW9ECr133Kyp7xVSvCrNflQIKVmGVCnpo-EvXgADOmqJPJcmSI2DGG83e1b1iW08Ap2AZqGpVPyjEv2mPFThO5GPbMTDBHYtau-ZNg3hBpoJy-DkmbFoSO1B_y8QVoaJw2I-GuTksCZmA/s1600-h/less+than.jpg">
automatically. I repeat with >, that is, type > into the "Find what:" box and
into the "Replace with:" box and click "Replace all".
Thanks to DarkUFO, found a slightly easier way of encoding the HTML codes for display at encode HTML entities. What you have to do is to paste the HTML codes in between and click "encode", then proceed as usual.
Once all the <> had been replaced, I copy the edited file in Notepad and paste the edited HTML codes into the scroll box by pasting it in between >< in the script for the scroll box. I will then edit the width and height (in red) to suit the width of my main column and a suitable height to accommodate the length of the HTML codes I want to display. For example, the width (in red) is already set to 395 which is what I want, so I leave it alone. I edited height="400" to height="39", publish, done.


0 comments:
Post a Comment