html - Embedding Code into my site -
i have pretty basic site constructed using simple html , css code. looking way embed code purposes of creating tutorial , came across http://hilite.me/. worked great java code put end result came out looking this:
here code in question:
<div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%"> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18</pre></td><td><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">org.openqa.selenium.by</span><span style="color: #333333">;</span> <span style="color: #008800; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">org.openqa.selenium.webdriver</span><span style="color: #333333">;</span> <span style="color: #008800; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">org.openqa.selenium.firefox.firefoxdriver</span><span style="color: #333333">;</span> <span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">class</span> <span style="color: #bb0066; font-weight: bold">webdrivertest</span> <span style="color: #333333">{</span> <span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">static</span> <span style="color: #333399; font-weight: bold">void</span> <span style="color: #0066bb; font-weight: bold">main</span><span style="color: #333333">(</span>string<span style="color: #333333">[]</span> args<span style="color: #333333">)</span> <span style="color: #333333">{</span> webdriver driver <span style="color: #333333">=</span> <span style="color: #008800; font-weight: bold">new</span> firefoxdriver<span style="color: #333333">();</span> driver<span style="color: #333333">.</span><span style="color: #0000cc">get</span><span style="color: #333333">(</span><span style="background-color: #fff0f0">"http://www.cnbc.com"</span><span style="color: #333333">);</span> system<span style="color: #333333">.</span><span style="color: #0000cc">out</span><span style="color: #333333">.</span><span style="color: #0000cc">println</span><span style="color: #333333">(</span>driver<span style="color: #333333">.</span><span style="color: #0000cc">gettitle</span><span style="color: #333333">());</span> driver<span style="color: #333333">.</span><span style="color: #0000cc">close</span><span style="color: #333333">();</span> <span style="color: #333333">}</span> <span style="color: #333333">}</span> </pre></td></tr></table></div>
how change 'box' around code fits wide code itself?
by default, <div>
elements have block display, which, default, has 100% width. there 2 easy ways fix this:
1. use inline-block display:
you can set div use inline-block display has automatic width:
div#mydiv{ display: inline-block; }
jsfiddle
2: set width.
if know exact width of content, can set width directly:
div#mydiv{ width: 400px; }
Comments
Post a Comment