html

...and Boston traffic view http://t.co/eC7X4KKZ 2 days 1 hour ago

f1vlad last spotted in:

Nashua, New Hampshire

Don't want to satisfy IE8? Don't have to

Today I found out that if you don't want to do any sort of modifications to adjust your site for IE8, you don't have to do that. It isn't ideal situation of course, but there definitely could be circumstances where this could be necessary; for instance, web developer got fired.

The following tag will make this happen:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

It will display standards DOCTYPEs in IE7 Standards mode and quirks DOCTYPEs in Quirks mode.

More info about this is available on MSDN website.

|

Do not forget display:table-cell

The last <table>-based website that I did was tomswebplaces.com, which I believe was in 2003. A lot has changed since, both on the web and the way I write HTML. But today I remembered <table> usage once again; that is, using <table> for layout and design, rather than tabular data.

The task at hand: to align text vertically in a div. At first quite trivial — div inside div, first position:relative, second position:absolute — until it comes to text wrapping. When text wraps to the next line, there's more white space above the box than below. I could not believe that there isn't a native solution for this. Few google queries revealed long forgotten display:table-cell, combined with vertical-align:middle achieves desired behavior. It works perfectly on all standard compliant browsers; however, IE6 and IE7 that do not support display:table-cell.

Below is the way I solved IE6/IE7 problem via adding extra wrapper <span /> around the block that is to be vertically aligned. This wrapper is used to imitate vertical alignment in these two non-compliant browsers, while proper layout is display in all, dare I say, normal browsers; it isn't perfect, but it works.

<html>
	<head>
		<style>
		div {
		border:3px dotted #ccc;
		height:140px;
		width:50%;
		display:table-cell;
		vertical-align:middle;
		}
		</style>
 
		<!--[if IE 7]>
			<style>
				span {margin-top:-1%;}
			</style>
		<![endif]-->
		<!--[if lt IE 7]>
			<style>
				span {margin-top:0;}
			</style>
		<![endif]-->
 
		<!--[if IE]>
			<!--[if !(IE 8)]>
				<style>
				div {
					position:relative;
				}
				span {
					height:140px;
					top:40px;
					display:inline;
					position:absolute;
					padding-top:3%;
				}
				</style>
			<![endif]-->
		<![endif]-->
	</head>
 
	<body>
 
	<div>
		<span>
			Long text that we want to vertically align in the middle in a div. Another sentense.
		<span>
	</div>
 
	</body>
</html>

In a couple of weeks, you will see how I utilized this method in production environment on slashdot user pages.

04/01/2009 update: finally I am able to reveal where I used this method: http://slashdot.org/~f1vlad/achievements, all achievements boxes are utilizing this.

|

How to look at HTML Source Code of a website rendered on iPhone?

For a couple of hours now I have been pulling my hair out about certain div's on a webpage being invisible on iPhone. I had guesses and theories by playing with css doing *{position:relative !important;display:block !important} but I absolutely had to see for fact what is going on in HTML. Randomly and incidentally, I came across this blog post which helped me tremendously.

In my case however, I did not want to view someone else's source. I wanted to examine mine. So I added this link to my HTML page and loaded it up on iPhone:

<a href="javascript:var%20sourceWindow%20%3D%20window.open%28%27about%3Ablank%27%29%3B%20%0Avar%20newDoc%20%3D%20sourceWindow.document%3B%20%0AnewDoc.open%28%29%3B%20%0AnewDoc.write%28%27%3Chtml%3E%3Chead%3E%3Ctitle%3ESource%20of%20%27%20%2B%20document.location.href%20%2B%20%27%3C/title%3E%3C/head%3E%3Cbody%3E%3C/body%3E%3C/html%3E%27%29%3B%20%0AnewDoc.close%28%29%3B%20%0Avar%20pre%20%3D%20newDoc.body.appendChild%28newDoc.createElement%28%22pre%22%29%29%3B%20%0Apre.appendChild%28newDoc.createTextNode%28document.documentElement.innerHTML%29%29%3B">View Source</a>
|

Mac OS X: Trying to disable EASY PAY on tmobile.com

For a number of reasons I decided to disable EASY PAY on my.t-mobile.com but learnt that it wasn't quite easy.

Having logged in to my account, I went to automatic bill page and unchecked Active; when I clicked UPDATE, nothing happened.

When you try to inactivate EASY PAY by unchecking Active box, you cannot submit the form on Mac OS X. Moreover, only a part of this faulty button is actually clickable; why not use <input type=submit value=Update>?
When you try to inactivate EASY PAY by unchecking Active box, you cannot submit the form on Mac OS X. Moreover, only a part of this faulty button is actually clickable; why not use <input type=submit value=Update>?

Submit "button" code:

<a href="javascript: { if (typeof(Page_ClientValidate) != 'function' || Page_ClientValidate()) __doPostBack('btnCCUpdate','') } ">
<img border="0" src="/images/mytmobile/ph/buttons/leftb.gif"/>
</a>
|
Syndicate content