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



blog comments powered by Disqus

Comments

Rahul Soni

Rahul Soni  Twitter

 LinkedIn

 Facebook

 Email me



Vivek Kumbhar

Vivek Kumbhar  Twitter

 LinkedIn

 Facebook

 Email me


Stack Exchange

profile for Vivek at Server Fault, Q&A for system administrators and IT professionals

profile for Rahul Soni at Stack Overflow, Q&A for professional and enthusiast programmers

Calendar

<<  May 2013  >>
MoTuWeThFrSaSu
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

View posts in large calendar

All Items
Sign in

Visit Microsoft's Site

Disclaimer

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

Powered by BlogEngine.NET 1.4.5.0