It not easy to create a good looking snippet for representing your code. But with few CSS trick it possible.
All you have to do is copy this code in your head tag </head> or search for <style> an paste it inside your HTML website or Blog.
<style> .cssterm { clear: both; box-sizing: border-box; position: relative; border-radius: 0 0 4px 4px; box-shadow: 4px 2px 8px #090909; padding: 12px; word-wrap: break-word; overflow-wrap: break-word; font-family: ubuntu mono, dejavu sans mono, courier new, Courier, monospace; background: #232323; background: rgba(9, 9, 9, .9); color: #63de00; margin-bottom: 1ex; title: 'Triple click to select a complete line!'; max-width: 97% } .cssterm:before { display: block; position: relative; width: 100%; left: -12px; top: -12px; padding: 12px; content: "Terminal"; color: #c9c9c9; font-size: smaller; font-weight: 700; line-height: 4px; background: #010101 } .cssterm:after { display: block; content: ""; position: absolute; top: 6px; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #88070e; background-color: #f4343e; background: linear-gradient(to bottom, #f7646c, #d00b16); right: 8px } .cssterm>*:before { display: block; content: ""; position: absolute; top: 6px; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #07880e; background-color: #34f43e; background: linear-gradient(to bottom, #64f76c, #0bd016); right: 32px } .cssterm>*:after { display: block; content: ""; position: absolute; top: 6px; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #917608; background-color: #f4d03e; background: linear-gradient(to bottom, #f7dc6e, #d9b10c); right: 56px } </style>
Now in your HTML or Blog where ever you want to add code just add
<pre class="cssterm" title="Triple click to select a complete line!"> <code> ############################### # SOME CODE HERE PHP|PYTHON|JAVA|etc... ############################### </code> </pre>
Output:-
# Program to generate a random number between 0 and 9
# importing the random module
import random
print(random.randint(0,9))
Comments
Post a Comment