Friday 6 March 2009

Css Tutorials: website components

Recently I was presented with interesting problem, and solution I provided was implementation of certain idea I have about how I *should* design my css styles.
The element I needed to provide was a form, that contained editable descriptions of different elements...


Each element needs a set of input fields. Some of them are marked common, and appear only once for an element but some of them define a "sub-element", and as such will be multiplied as much as many sub-elements are added by user. Some of components won't have sub elements, so they will contain only common input fields.

To implement this layout I used a component abstraction. Each element will be displayed by generic layout component. Here's is a html code that defines three components:



I'll need three different components to describe different situations that my happen in the life time of application. There is "normal" component, with three subcomponents, "empty" component, and "big" componend, filled with many subcomponents.
Let's add some input fields:

And let's create buttons panel, to allow user add and delete subcomponents:

As you can see here, the whole thing doesn't look so good, but hey, that's whay Gods created CSS, right? :)
So, let's start styling.


Now, that looks better, right? We have a main components, and subcompontents visible inside.

Different styling may cause the whole thing look completly different - see this example for the simpliest ajustments.

No comments:

Post a Comment