Why do I like overflow:scroll so much?

by Rahul 6/10/2008 8:16:39 PM

There are times when you want to incorporate a picture, a large piece of code in a limited web space... ex. a blog post which has a lot of <DIV> tags. Now, to crop or resize the picture may not be the option always. I still see a lot posts where the images are either cropped or line breaks are introduced into the code.

The problem with the line break is that it increases the overhead and time spent on the blogger's part in formatting the post. Apart from that, it also creates chances of typos which would make that code snippet not compile when an end user tries it.

Let's say I have a piece of code which I want to blog about (in Windows Live Writer)...

I use Paste from Visual Studio plugin and really love it. When I paste my code from Visual Studio using the Plugin, here is what I get...

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Reflection" %>
<%@ Import Namespace="System.Drawing" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ OutputCache Duration="72000" VaryByParam="none"  Location="Any" %>

See how the 4th line overflows! Not good, right? So, what next???

Noooo... please don't split that line.....

Select View -> HTML Code and add the DIV tag as follows around the code.

<div style="overflow: scroll">

Your Code Or Image.

</div>

Here is the output...

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Reflection" %>
<%@ Import Namespace="System.Drawing" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ OutputCache Duration="72000" VaryByParam="none"  Location="Any" %>

Hope this helps, Wave
Rahul

Tags: , ,

CSS | Tips and Tricks | Windows Live Writer

blog comments powered by Disqus

Comments


Disclaimer

The opinions expressed herein are our own personal opinions and do not represent our employer's view in any way.
© Copyright 2014, Rahul Soni