webeno's tutorials for beginner website designers, bloggers and internet marketers
Showing posts with label div. Show all posts
Showing posts with label div. Show all posts
Sunday, February 17, 2013
Even or odd number validation with PHP
The other day, while I was writing up some PHP code, I ran into a really cool way of identifying if a number is even or odd (refer to the link further down below). I needed it as I looped the creation of a couple of divs and wanted the odd numbered ones to be floated left, the evens to the right.
Wednesday, February 03, 2010
abolute position within div - a one liner
If you want to use absolute positioning within a div, you just have to set the parent div to relative.
You should put this in the head between the sytle tags:
You should put this in the head between the sytle tags:
Thursday, January 14, 2010
Center div with margin: 0 auto - a one liner
The best and cleanest way to center a div is to use the margin: 0 auto attributes in styles. Make sure however that you set a width of the div to something specific otherwise it's not going to work.
See an example of the style attribute below:
(click in the box to highlight the code for copy)
Note: it seems that this unfortunately doesn't work in IE7. Alternatively you may use the <center> tag.
See an example of the style attribute below:
(click in the box to highlight the code for copy)
Subscribe to:
Posts (Atom)