Tag Archive: CSS

Changed to a new theme

blog.robbychen.com theme

For some reasons, I just don’t like the default 2014 theme included in the WordPress. It’s neither attractive nor minimalistic. I’m not a big fan of black and white theme, especially there is a green search button at the top right corner.

The theme I’m using right now is Sixteen. I chose this theme from featured theme section because I know that I will have a hard time searching for a preferred theme from a vast selection of themes.

After I switched to this new theme, I began to tinker its settings and code. Shortly after, the new theme for this site is created.

I changed a few settings for the theme, especially the header image. I’d like to make the site as simple as possible, so I changed the header image to a single colored image (green-ish color, resembles the color of Google Android).

And here is the custom CSS I wrote to achieve the current layout for the site:

The first style in the code above changes the widget title’s text color and navigation menu’s link hover color. I don’t like the original color because it’s too dark in contrast to its black background and it’s hard to see. I then switched the link color for the navigation menu with the original link hover color to be more relative between the link and hover states in the second block of code since they all contained yellow.

Within the last style, I fixed the link for the featured image not cover the entire area for the featured image area on the homepage. If you don’t understand the last sentence, try to install this theme on your local WordPress and insert a featured image which its width is less than 230px or its height is less than 140px and see what happens with the link when you hover over the featured image on the homepage. This should give you the reason why this fix is needed.

Of course, I’m not proficient in CSS. If you find any errors in the code above, any errors on the site itself, or any general questions or issues around the site, please leave a comment below and I will respond to you (as well as fix the mentioned issue if appropriate) as soon as possible.

Write CSS3 with Understandable Variables with LessPHP – Part 2 (Updated)


Update: I updated the code to add more explanation on the Flexible Box Model related properties.

LessPHP provides CSS stylesheet to have variables for reducing repeatable code in order to improve productivity.

In the last part, I talked about how to installing the LessPHP and general folder structure of an one-page web app using LessPHP. This part I will provide you with var.less which includes some CSS3 properties discussed in this post on Nettuts+.

Note that all of the code used LessPHP and CSS3 syntax. If you don’t understand the LessPHP syntax yet, here is its full documentation.

Some of the above code is commented to give you more information about the acceptable values. One of the code blocks, @defaults, provides you the basic layout for an element. It allows you to add other CSS properties to enhance its layout. As the comment stated, it also provides you with a test layout to test an element.

You also can use the above code as a reference to CSS3 since some people think that CSS3 is harder and more complex than CSS2

You probably noticed that there aren’t multiple background images and @font-face, that’s because I can’t figure out how to integrate them with LessPHP yet.

Do you have any problem using the above stylesheet? Leave a comment below and I will respond to you quickly.

Display Images Horizontally Without Auto Wrap

Update (12/12/2010): I wrote a jQuery snippet to animate the scrollbar to be more interactive.

Update (10/14/2015) The Google Code University which mentioned in this article is no longer active. It removed all of the tutorials and focused on Android development.


The images, like text, will automatically wrap to the next line if you don’t apply any styles. In order to prevent that, I believe that most of you use table to solve this issue. Using the table to do the horizontal images layout is easy, you just apply the multiple <td> tags in a single <tr> row. However, this type of table usage is not recommended. According to HTML, CSS, and Javascript from the Ground Up from Google Code University, HTML is used as the structure for the document whereas CSS is used as the presentation for the document. In this case, HTML is used as the presentation of the document which is against the rule. Therefore the code becomes not as clean as the structured document. In order to convert this to CSS, you need to follow the structure and CSS below.

The Source Code



The Comparison

Here are the examples of before and after applying the styles:

Before the styles were applied


After the styles were applied


If you want more information about white-space CSS property, refer to the W3Schools website.

Do you often use tables for the structure or the presentation of the HTML document? Discuss in the comments section below.

P.S. Google Code University has lots of free courses/lectures ranging from web programming and web security to web design and other web-related areas. It is a good place to start learning the essentials for each of these skills.

Switch Between Stylesheets Dynamically with jQuery

jQuery Tips


I recently learned that almost all of the modern browsers supports CSS3’s media queries. Since I want my webpage cross-browser compatible and display the same layout in different screen sizes, I wrote the following jQuery code inspired by the original Javascript code.

The Code


As you can see, I only used the netbook screen size as an example since my netbook has maximum screen width of 1024. You can also easily switch to mobile stylesheet to display on the mobile device by changing the screen.width value in the if statement from 1024 to some smaller value.

Note that unlike the CSS3 media queries, screen.width is your actual screen width instead of browser width. Therefore, using this method will not change the stylesheet on the resized browser window.

If you find any better method to determine the screen size other than CSS3 media queries, please feel free to discuss in the comments below.

Site Menu Animation Prototype

I have been playing around with MooTools recently and came up with an idea to allow users to change the orientation of the menu for my updated site with animation. MooTools is an Object Oriented JavaScript framework similar to jQuery. The main reason I chose this framework instead of jQuery is that it can easily create customized animations. Although I’m still learning how to use MooTools’ full features, I wrote a HTML page that toggles between vertical and horizontal menu with custom animations just by using MooTools framework. Note that this is a prototype to the upcoming updated site menu. It only contains the background color and doesn’t contain any content. Here is the MooTools code for the page:

Notice that I used CSS property names and MooTools functions to create animations. You can view the whole source code by right-click the prototype page since it is just a plain HTML and JavaScript page.

I created this prototype with the help of MooTools 1.2 Beginner’s Guide and MooTools Docs.

jQuery CSS Browsers Compatibility

jQuery Tips

Different browsers require different CSS property syntax, especially in CSS3. In CSS2, the only property that I know of requires different syntax is opacity property. Firefox called opacity, and IE called filter. You need to set values for opacity and filter properties at the same time. Not only this is inefficient, but it also adds up the size of the CSS file.

Fortunately, jQuery has a css function to make the CSS cross-browser compatible. For example:

It will auto changed to filter CSS property if the user is running IE.

For more information about jQuery CSS and a jQuery plugin to support CSS3 syntax, please read original article.

Yahoo Design Pattern Library

Yahoo Design Pattern Library homepage
Click above image to visit its homepage

Yahoo Design Pattern Library is a collection of web page design pattern. According to its website, the main purpose of the library is to solve web design problems through optimal solutions. There are lots of design patterns to choose from, from layout, navigation, selection, rich interaction, to social.

Yahoo YUI Library homepage
Click above image to visit the homepage

Since this is an Yahoo-owned library, it uses YUI library. However, you can use whatever CSS and JavaScript frameworks once you understand these patterns. There are enough patterns in the library to inspire me to have different design layouts for my new homepage. I was very glad to discover this library through watching Doctype Episode 19.

CSS3 @font-face property

CSS3 introduces a new method for formatting the font on the web page using the font files stored on the local server instead of using the font installed on the user’s computer. By using @font-face property for CSS3, web developers could use their own fonts to format the web page in order to make the same page layout across browsers without worrying the cross-browser page layout. Of course, Internet Explorer doesn’t support CSS3 yet. Below is the syntax for the @font-face property:

As you can see from above code, the @font-face property acts like a function. It defines font-family and file location. To use it, simply add the font-family name into the font-family list in the element that needs to be formatted. This is great for logo design which uses some creative fonts.