Write something everyday in the evenings or very early mornings without waiting for the weekend.
For the bars, I put together a collection of rectangles which I colored using the Photoshop gradient tool to give each bar a three dimensional look. The image file which is a collection of 10 bars becomes the background for every list item.
I will be using the CSS Sprite technique where you shift the background image around to display only the part of the image that you want. Putting the background for all bars in one image allows the page to load faster. Although I have the height set to pixels which is the full length of a bar in the bars.
By allowing height information entry from XHTML, we'll have a flexible graph that is not set in stone. If someone forgets to enter a number, the bar will have an initial value of percent.
The text-align, font-weight, color and line-height are all for the styling of text that is going to inside the bars. The text-align property centers the text within the bar, line-height provides space between the text and the top of the bar, and we use bold styled text for legibility.
The height of each bar represents a numeric value in the y-axis. I can display this value either just outside of each bar on top of it or choose a good contrasting color like white and stay inside the bar which is what I chose to do in this case.
The font is white and bold with a line-height of 2. Alternatively to display the vertical numeric value outside of a bar, I set the position to relative and moved the top by pixels using "ul.
The text color in this case is a dark grey to provide contrast to the graph paper underneath. When there's a relative position, the browser leaves a hole behind where the element was supposed to go and displays it in the new specified position.
Printing outside the bar is useful when a bar is too short because of a low y-value, it will not have enough space for the number to go inside it.
As the browser is rendering each list item will look for matching rules in the CSS and will apply them according to their specifity and the order in which they appear.
So for list item, the general li styling will cascade down to the more specific li's such as bar1, bar2, bluebar, redbar and so on. This is called "cascading".
Bottom position is the same for every li item or bar - 29 pixels as it was declared in ". The horizontal value changes so each different bar class gets its own left or x-value.
List item "bar1" comes before "bar2" so it's left value is at 21 pixels while "bar2" is at 94 pixels. Unless set differently from a more specific li down the line, the background image for all li's is bars.
Using the background-position property we can shift the image to choose a differently colored bar for each li.
The blue colored bar is the first bar in the file so the background-position for "bluebar" is set at zero pixels. This is the beginning of the image file. The width of the li block element is set to 30 pixels which is the same width of a bar in the image file.
So we show only the first 30 pixels of bars. To get to the red bar, we shift the background by 30 pixels to the left and display the next 30 pixels which happens to be the red bar in the file.
These positions will also determine what point of the background corresponds to the point on the element li in our case.
Since we are using "bottom", we will be starting from the bottom of the bars.I want to blog consistently this coming month. Write something everyday in the evenings or very early mornings without waiting for the weekend.
Word of the Year. Our Word of the Year choice serves as a symbol of each year’s most meaningful events and lookup trends. It is an opportunity for us to reflect . Word of the Year. Our Word of the Year choice serves as a symbol of each year’s most meaningful events and lookup trends.
It is an opportunity for us to reflect . Port Manteaux churns out silly new words when you feed it an idea or two. Enter a word (or two) above and you'll get back a bunch of portmanteaux created by jamming together words that are conceptually related to your inputs..
View live demo and download source code.