Hello there. I am Terry and I am a full-time undergraduate based in Singapore. I take photos, write a blog and design websites.

And no, I'm not a teddy bear.

Borders – An experiment with border widths

After reading the fantastic writeups about manipulating CSS borders to create graphics that are impossible with grid-like elements on Slantastic and Border Slants, I was inspired to do a simply followup demo page on the capabilities of CSS borders. I started working on this secret, clandestine page on my domain since half a year ago but I didn’t had enough time to complete everything. Finally came my long-awaited semester break, when I can devote a day’s time to finish this demo page.

You can view the demo page here. Do not right click on the link, simply do a click-through.

view demo: Borders – An experiment with border widthsVersion 1.0 \ File size: 4 KB \ 43 downloadsA demonstration page on how we can manipulate CSS borders to create custom shapes and polygons.

Borders - An experiment with border widths

Borders - An experiment with border widths

The visual elements shown in the remainder of this post will be drawn purely using CSS only – not images. Feel free to dissect the code for reference. It helps a lot if you can try imagining how you would want to construct a specific shape before referring to the source code to see how it is done.

The Basics

The principle behind creating custom shapes using border is the interface between two borders:

By increasing the border-width, the slant becomes more apparent. We can manipulate each of the border-widths to create the gradient that we want as well.

Triangles and Trapeziums

It becomes clear that we can create triangles and trapeziums based on the observation of such behaviours at the interface of two borders.

Trapeziums are possible too, if we increase the width of the empty <div> from zero to a positive numerical value:

Regular Polygons

Creating regular polygons require some calculation. Their parameters can be found in the source code, and you can scale the border-width and width properties in order to scale the entire polygon proportionately.

From left to right, we have triangle (trigon), quadrilateral (tetragon), pentagon, hexagon and heptagon. The demo page will have more regular polygons, up to decagon.

Creating Graphics

For more examples, refer to the demo page: Borders – An experiment with border widths.

One advantage of creating visual elements using CSS (and in this case, CSS borders) is that your visitors will not have to download images that are huge. Of course, this technique is usually experimental because certain image extensions such as .png and .gif will greatly reduce the size of images (given certain conditions) and that it is sometimes not feasible to code an image from ground up.

What you see on the left is one of the examples demonstrated on the demo page. The Christmas tree is actually constructed from 10 <div> elements vertically stacked on top of each other. The topmost <div> has its borders modeled after a triangle, while subsequent <div>s have their borders modeled after trapeziums. Their border-width, margin and width has been adjusted so as to give the tree a tapered out look towards the bottom. I finished off the tree with a brown stump made from a single <div> again.

And there you go – the code for the lovely, purely CSS Christmas tree (all encoded in inline CSS so that you can understand how it works – and for the sake of clarity). Do remember to wrap it around a box with a defined width.

<div style="margin: 0 auto; font-size: 0; line-height: 0; border-left: 10px solid #fff; border-bottom: 20px solid #238229; border-right: 10px solid #fff; float: none; margin-left: 90px; width: 0;"></div>
<div style="margin: 0 auto; font-size: 0; line-height: 0; border-left: 10px solid #fff; border-bottom: 20px solid #238229; border-right: 10px solid #fff; float: none; margin-left: 86px; width: 8px;"></div>
<div style="margin: 0 auto; font-size: 0; line-height: 0; border-left: 14px solid #fff; border-bottom: 20px solid #238229; border-right: 14px solid #fff; float: none; margin-left: 78px; width: 16px;"></div>
<div style="margin: 0 auto; font-size: 0; line-height: 0; border-left: 18px solid #fff; border-bottom: 20px solid #238229; border-right: 18px solid #fff; float: none; margin-left: 68px; width: 28px;"></div>
<div style="margin: 0 auto; font-size: 0; line-height: 0; border-left: 22px solid #fff; border-bottom: 20px solid #238229; border-right: 22px solid #fff; float: none; margin-left: 56px; width: 44px;"></div>
<div style="margin: 0 auto; font-size: 0; line-height: 0; border-left: 26px solid #fff; border-bottom: 20px solid #238229; border-right: 26px solid #fff; float: none; margin-left: 42px; width: 64px;"></div>
<div style="margin: 0 auto; font-size: 0; line-height: 0; border-left: 30px solid #fff; border-bottom: 20px solid #238229; border-right: 30px solid #fff; float: none; margin-left: 26px; width: 88px;"></div>
<div style="margin: 0 auto; font-size: 0; line-height: 0; border-left: 34px solid #fff; border-bottom: 20px solid #238229; border-right: 34px solid #fff; float: none; margin-left: 8px; width: 116px;"></div>
<div style="margin: 0 auto; font-size: 0; line-height: 0; background-color: #6e3912; border-right: 2px solid #ac5f26; margin-left: 92px; width: 14px; height: 40px;"></div>

One may also explore other options of using CSS borders in creating visual elements – for example, you can use jQuery insert the necessary code into the start of list items, bulleting each item with a tiny triangle created by CSS borders. Of course, this method will be frown upon by semantics purists, but I’m going to leave the discussion open.

Credits, Resources & References

I would like to thank the genius designers who conceived the idea of creating custom shapes using border slants. It never came across my mind until I read Slantastic and Border Slants. I have also learned how to code for border slants from there too.

There are several aspects of the application of border slants that I fail to cover in this article and my demo page. The reason is simple – because they have been done before and little follow-up is needed. Try checking the two links above – they provide intricate explanation on how wrapping text around a diagonal shape is possible. Go figure!

There are a lot more techniques and ideas that I have included in the demo page. I did not include them in this article to keep it short and palatable :)

Your thoughts?

What are your thoughts on the manipulation of CSS borders and their applicability? If you have any questions regarding the demo page, feel free to post your questions in the comments below. I will be more than happy to help!

Family is still the dearest

Family is still the dearest

Family is still the dearest

I returned to my mom’s hometown to celebrate the biggest festival of the Chinese culture – the Lunar New Year. My mother was born in a modest family in a town named Bukit Mertajam, which is located at the foot of a mountain. After graduating from secondary school she traveled south of the Malaysian capital Kuala Lumpur in search of an interior designer job, and that was where she met my dad. She could still recount to me with great detail how her Ugly-Betty-esque experience when she first started work – her colleagus scoffed at her comprehension of the local dialect, or rather my mom’s lack thereof, and how she had a hard time working with colleagues that are cunning and throw knives at your back (or sometimes right in your face).

That’s just the backstory. We have been traveling to the sleepy little town of Bukit Mertajam every year since I was an infant. My mother would tell me how much my grandpa loved me – as an infant I was very disturbed by the foreign envrionment in my grandparents’ house, and grandpa made great effort to make me feel home, which includes using a lot of money making all the windows mosquito-proof.

It has been a tradition of my family, as well as the extended maternal side of my family, to travel to this place during Lunar New Year. We would gather at my granduncle’s house where my greatgrandma is living to meet each other on the first day of the new year. In the 20 years of my life, we only missed it once – back in 2009 there was some problem and all of us decided to celebrate it in the capital instead, and boy I tell you how different it felt. If you ask me, I’d prefer celebrating this time of the year with my family in Penang. Nothing beats the close bonding of a family.

603km on a jet plane

603km on a jet plane

Oh, and here’s a photo of the plane that I took to Penang. It’s pretty cool, isn’t it?

Returning to Singapore

I had to leave Penang on the third day of the new year because my unforgiving, unapologetic lecturer decided to conduct a test. Unlike my other Malaysian friends who remained in Malaysia for the entire week, I didn’t have the luxury to do so all thanks to a pathetic quiz.

The halls of residences were totally deserted, even when I arrived on the evening before school started. Even locals are skipping lessons in the spirit of the new year, and I couldn’t believe I am missing out all that family loving for that test. For once I regretted by decision to return early. I even got a little homesick, especially when mom called the day after hearing all my other relatives in the background having a really good meetup.

However, my trip back to Bukit Mertajam renewed my hopes of my family. As I grew older, I was informed of problems that were deep-rooted in my family. Conflicts and bickerings, disagreements over care of parents, financial issues and etc. Mom felt that I was too young to handle the truth back then, so she didn’t really inform me about those. Over the years I uncovered flaws of my dreamy extended family – no matter how close we are, we are still imperfect and I guess that is what makes us human. I was very worried about one particular thing – what is holding my extended family together is the close bonds between the older generation. The younger generation congregated into cliques. I could not imagine the family fabric being gradually torn apart as we replace our grandparents and parents. What will my extended family be like, say, a decade into the future?

However, that doesn’t stop me from loving them. Afterall, we are family. Problems can be resolved, if everyone take a step back and look at the big picture instead of being increasingly obsessed with their personal interests. It is nice to see everyone together again this Lunar New Year, and I hope we can keep this tradition alive as long as possible.

Happy Valentine’s and Lunar New Year!

It’s the time of the year again – fire crackers, albeit being condemned by the government as dangerous and illegal, going off in the distance; and fireworks lighting up the dark, clear and moonless night sky. Everybody in my hometown, Penang, is welcoming the Lunar New Year with a huge bang. Afterall, our celebrations are notoriously noisy, especially when it comes to lion dances. I could still remember very vividly how it felt like to experience heart palpitations when I stood too close to the thundering drums when I was a little kid.

Since then I have diligently shied away from the musical instruments, stopped being a nosy kid poking around the village for lion dance performances and joined the crowd enjoying the performance from a safer distance. A safer distance simply because you wouldn’t want to be showered with a generous offering of peeled tangerine skin when the lion dancers ritually peel the fruit up (or sometimes even tearing vegetables up) and throwing it away, right towards the crowd that is looking on intently.

Oh, and it’s Valentine’s Day too! Here’s a really nice poster I’ve got from my Tumblr feed:

Love is like Pi.

Love is like Pi.

Via chiawei: schmae: fuckyeahhappy

So far I’m doing good without much Internet access. Looks like I wasn’t *that* addicted afterall :)

Dining at IKEA

To many, IKEA is simply an oversized furniture store that is designed as a maze to entrap innocent customers like us. My parents love IKEA though, because they would take a long time going through each of the display rooms and check out how they use space so efficiently and yet comfortably. For me, I always go to IKEA for one thing and only – food, that is.

Bregitt and Rick at IKEA's cafe.

Bregitt and Rick at IKEA's cafe.

A few weekends ago, Bregitt, Rick and I headed over to the IKEA outlet at Queenstown to look at their displays and more importantly, to eat. All of us share this love of their food – from their Sweedish meatballs to their local delights. Not to mention their $1 hot dogs on the ground floor! Everyone can have themselves a very generous helping of mustard, chili sauce or tomate ketchup – all in the goodness of a dollar.

My lunch - poached salmon with black pepper sauce.

My lunch - poached salmon with black pepper sauce.

That’s my lunch – poached salmon with black pepper sauce. I am a big fan of boiled baby carrots too! Of course, IKEA food fans like us will never miss out their meat balls – Bregitt got a huge plate of it and we shared the dish among ourselves.

Sweedish meat balls

Sweedish meat balls

One thing I like about IKEA is their effort to incorporate local dishes into their menu. In Malaysia, breakfast will usually be nasi lemak1. I’m not very sure of the menu in Singapore but I do know that on a few occasions, they do sell stewed beef as lunch and dinner in their cafe.

Dear readers: At what unique places do you enjoy eating?

  1. With roots in Malay culture, its name is a Malay word that literally means ‘rice in cream’. The name is derived from the cooking process whereby rice is soaked in coconut cream and then the mixture steamed. Sometimes knotted screwpine (pandan) leaves are thrown into the rice while steaming to give it more fragrance – Wikipedia

Revisiting Hwa Chong

Clock Tower Building, a HDR.

Clock Tower Building, a HDR.

I grew up in Hwa Chong Institution – since I very luckily scrapped the bottom for a candidature slot for the Singapore Mathematics Olympiad and found myself in Chinese High School in 2001, I decided that I will spend many years of my future in Singapore. I ended up, again, very luckily snagging a slot in Chinese High School from 2002. I graduated in 2005, moved on to Hwa Chong Junior College in 2006 and then graduated with a Cambridge A Levels certificate in 2007.

In the 6 years in HC, I witnessed many changes made – from the construction of the new boarding school to the tearing down of the ricketty, old, demure hostel that made way for a new CCA building; from the celebration of the 85th anniversary of foundation of the high school section to the ultimate, prized merger of Chinese High School and Hwa Chong Junior College into a single, functional entity now known as Hwa Chong Institution.

I could still remember how terrified I was of my history teacher Ms Teo. I never quite passed a history test in my first two years of secondary school much to her disappointment and my frustration. My English was in shambles when I first arrived, and under the tutor (and frequent scolding and cudgeling) of my English teacher Ms Kalavathi, my English improved gradually over the years. However, she made me hate reading novels – I only regained my love for reading in the recent years after being introduced to White Oleander a few years back.

Another teacher that really left a lasting impression in my mind was Ms Esther Cheong. She first came across as the fierce and loud teacher that scared all the young, immature secondary school kids shitless *laughs* but after she taught my class geography, she’s actually one awesome teacher. She’s a very nurturing and kind teacher inside. Her screams and howlings at bad students still haunt me till today, though :)

College years were marked by frequent and short-lived bouts of depression – an undesirable manifestation of adolescence. I am not ashamed to admit that I felt that I needed counselling, and the horrible thought of actually ending one’s life did, for a very brief moment, emerged from the sea of darkness. For most of the time I seeked solace with my Malaysian friends who have a much kinder demeanor than many others, and that was it.

Ms Kwee and Ms Wong were one of the teachers that made me feel better about college life. Ms Kwee was, is and will be, without doubt, the best mathematics tutor I have ever come across. She voluntarily stayed back on school days, working way past her working hours without any concern of monetary remuneration to help students who were weak in maths. She selflessly conducted revision and remedial classes, dished out maths questions quicker than the fastest printer. Her caring demeanor helped a lot in convincing me to anoint her as the best teacher ever.

Ms Wong was the funny, down-to-earth biology teacher. She gets very strict sometimes (especially on timing, you wouldn’t want to know what happened when we ran late for lectures and tutorials) but then again, that’s what makes her a great one.

In a flash, I graduated and left HC for good. Or that was what I thought.

Soon after, I started to miss my life in HC a lot. I was dumbstruck by the newfound freedom in university – in terms of my life and academic pursuits. No more curfew for the hostel dorm, but I had to make do without a shared refrigerator and a microwave as provided in college dorm. No more compulsory lectures and tutorials, no more attendance taking of sorts. If you don’t motivate yourself in university and watch your back, you’re a piece of dead meat.

So last Friday I actually took the liberty to travel all the way back to HC, just to relive that very few moment of bliss of which I can now still remember.

Just so in case you’re wondering, the first photo is the clock tower building which sits on top of the gentle hill overlooking the tracks and the soccer field. There’s where I spent my last year in high school in – fully air conditioned (but stinky as hell) classroom :)

The central courtyard.

The central courtyard.

This is the place where we had our daily flag raising ceremony in the morning, except on Mondays where we will have to proceed (and we do it very sluggishly, much to the dismay of our teachers) to the high school field. Every morning you’ll see people rushing like madmen towards this very courtyard because after the bell rings, latecomers will be considered as absentees. That day the courtyard seemed to be deserted, besides three guys playing frisbee.

The new administration office.

The new administration office.

You wouldn’t believe this but the new administration office (which also holds the principle’s office) is actually converted from a rather old building on campus. What they did was to totally knock down the interior, build a huge roof extending from the front of the facade, some really decent paint job and voila!

High school section

High school section

The high school section has a really nice water feature running along the blocks of classrooms and it ends up at a fountain near the old administration block. I spent my first two years of secondary school on the block to the left, and then my third year in the white block far right.

Boarding school, a HDR.

Boarding school, a HDR.

The boarding school, containing seven halls of residences, was designed by renowned architect Kenzo Tange in 2005. I believe it is one of the last works of his before he passed away in March 2005. The blocks were clustered around a central courtyard or festival garden, complete with a meandering stream. I spent my first 6 years living in this place. Don’t be deceived by the good looks though – as far as I could remember, the food can only be described by a word – bleagh. We were served the same common fodder everyday, and I clearly remembered how sick I could get by just the mere thought of canteen food, so much so that for most of my college life I actually dined elsewhere before returning to my room.

Looking up a void in one of the halls.

Looking up a void in one of the halls.

The style of the boarding school differed remarkedly from Kenzo Tange’s older style though. I adore the high ceiling heights and generous space in the form of voids that were included in the design – this made the entire complex rather windy, especially during stormy nights. It also helped that the boarding school was located on top of a taller hill behind the school, and many of us actually land a room with a great view of Bukit Timah and the town.

There were rumours circulating that the school was intending to auction this very plot of land off to private corporations – that came at no surprise to me due to the pristine location. Good view, check. Great location, check. Famous school, check.

I left the school around early evening to avoid the evening crowd. With a heavy heart I bid HC goodbye, and I’m sure I’ll return to my alma mater some time in the future again :)

Page 1 of 18812345»...Last »
teddyrised @ Twitter

Calibri looks so painful without ClearType. I wonder which smart alec turned that off on my library computer.

Recommended follows » More?

Gaya Kessler (gayadesign)Walter Apai (DesignerDepot)Fubiz (fubiz)Diana Khalil (DianaKhalil)Manuel Koell (iammanu)Anthony Hortin (maddisondesigns)Zane Taylor Anderson (ZaTaylor)Jesse Newhart (JesseNewhart)Grant Friedman (Colorburned)net.tuts+ (NETTUTS)Fabio Sasso (abduzeedo)Richard Darell (Minervity)Vandy Russ (passionsista)Lorenzo Gabba (_enzo)
Tafari (bygbaby)Creattica (creattica)James White (signalnoiseart)Roger Byrne (styletime)John Rawsterne (patternhead)Oridusartic (oridusartic)Jay Hilgert (bittbox)Matt Richardson (mrrichardson)Jacob Cass (justcreative)Interactive Blend (iBlend)Chris Spooner (chrisspooner)Lester Chan (gamerz)Dean Robinson (deanjrobinson)Juanma Teixido (Teixido)Dainis Graveris (1stwebdesigner)psd.tuts+ (PSDTUTS)Andy Sowards (andysowards)Ahmed Naguib (ahmednaguib)Chris Wallace (chriswallace)Sheng Han (embr)Latrina (blistersinmay)Graham Smith (imjustcreative)Serhiy (frujo)Eren Emre Kanal (erenemre)Reg Saddler (zaibatsu)Line25 (line25blog)VideoHive (videohive)Dayna (amourchaleur)Ivy Tan (nanyante)Donncha O Caoimh (donncha)S.M. Faisal Al-Yahya (MacSheikh)Branden Silva (Brandensilva)Chien Yee (akinodrama)Chris Pearson (pearsonified)Bkmacdaddy Designs (bkmacdaddy)Vince Dudzinski (pairadocsdesign)Lee Munroe (leemunroe)Fred Yates (fredyatesiv)Justin Tsang (mephobox)WP Studios (wpstudios)Chad Engle (chadengle)Khayyam Wakil (iamkhayyam)Calvin Lee (mayhemstudios)Smashing Magazine (smashingmag)Phao Loo (phaoloo)Rob MacKay (svgrob)

Want to be listed? Be an interesting tweeter (or some prefer tweeple), make sure that I know you're around and that's all it takes.

Archives » Dig even deeper

2010 12 11 10 09 08 07 06 05 04 03 02 01
2009 12 11 10 09 08 07 06 05 04 03 02 01
2008 12 11 10 09 08 07 06 05 04 03 02 01
2007 12 11 10 09 08 07 06 05 04 03 02 01
2006 12 11 10 09 08 07 06 05 04 03 02 01
2005 12 11 10 09 08 07 06 05 04 03 02 01
2004 12 11 10 09 08 07 06 05 04 03 02 01

Hello Easter Egg hunter! You've discovered the magic of the Konami Code!

Yea. You probably know what the Konami code is before getting to this page. So now what? Here is a randomised YouTube video on my favourites list... which includes Rickroll, if you're luck enough to get it.

You are currently watching Ice Sculpture Fail. Loving it? You can even watch the video in its full screen glory :)

The Konami Code:
Konami Code sequence