Why do I like overflow:scroll so much?

by Rahul 6/10/2008 1:04: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



blog comments powered by Disqus

Comments

Search


Tags



Categories

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

All Items
Sign in

Disclaimer

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

Powered by BlogEngine.NET 1.4.5.0