agroove . I knew that groove was in your heart

March 13, 2009

my css level after ~3 yrs at navarik

POSTED IN randomness

TAGS

today is my last day at work, i started at navarik when they first moved into this current building as a co-op back in 2005 or something, then i did part time here and there til i finally got myself a full time paper to sign, my first day in 05 my job was setting up my own comp and build an ikea desk for don’s office (i dont think i’d ever forget ha)

my main work here has always been doing html/css, i take mockups and make templates, then i fix ui bugs for our application, like 80-90% of the time that’s all i did, for THREE+ YEARS

one of the last thing i’m doing is writing bunch of comments and documentations to help people using our mega thousand lines of css files, which i thought this might be something good to share, they’re not super complicated or anything, and you can probably google most of them too

align a block element right
- set margin-left: auto to align right (setting both margin left and right auto will let you align center – margin: 0 auto)
- make sure you set clear: right after or use the clearfix class to avoid potential weird layout bugs
- one way to put 2 block elements in the same row, but one align left and one align right is to set float: right on the right block, but in the html put the right block code first, if you put left div first (even though it probably makes more sense to do so) right div will be align right but placed under left div, not in the same row

positioning
- negative margin top will shift up, negative margin bottom will actually shift the element below up (so it overlaps)
- set position relative or absolute also lets you set z-index, sometimes position: relative works well with negative margin

no line break
- white-space: nowrap works only on inline element (i’m pretty sure) – <span>, <label> and not <div> or <td>
- try not to use <nobr> i think it’s deprecated html

table+borders
- (old way) set table to have top and left border, set all cells to have right and bottom border
- (better way) set table and all cells to have border, then set border-collapse: collapse

image background
- you have to set display: block most of the time to use background image (so you can set width and height on the block), but sometimes if you have a small text/link with icon, you can set it on the a/span, and just give it additional left/right padding, or adjust the line height, cause the awesome inline-block only works in IE

below is a list of crazy things that usually happens in IE only

100% and padding
sometimes when 100% width is set on a div or table, it will expand to the full width of its container, this doesn’t include the padding set on the container so the div/table width may exceed the parent container
FIX – if you must have space around the parent block, one way to work around it is to set no width on the inner block element (div, p) and just set margin instead, may not work for table

shifty textarea
when a text area is set to 100% width, it will expand to the full width of its container, but if the container has padding set, the text area will appear fine, but once you type something inside, it will expand and the width may exceed the parent container
FIX – use the <fieldset> tag, this is used in claims, google for example

overflow scroll container with elements inside
when overflow auto or scroll is set, in FF the scroll will appear outside of container, in IE it appears inside of container – this sometimes causes a problem where horizontal scroll appears because the vertical scroll is covering up the content inside the container
FIX – right now the current solution is to set the inner child div/table/element to be 98% width or something

bleed through select box
when you use div as a dropdown menu, when it overlaps a select box, the select box will bleed through the div block and there is no way around it, the select boxes exist in some magical top layer that no element can get through
FIX – the trick is to insert an iframe underneath the dropdown (YUI does the same fix), insert an iframe tag and style it so it is exact same size as the div block dropdown and position in the same spot as the dropdown, and then set the z-index value for the dropdown 1 higher than the iframe

radio button alignment
radio button and its label never have good vertical alignment, the alignment are not the same in IE and FF so you can’t really just set the vertical-align property


112 Responses to my css level after ~3 yrs at navarik

  1. In related news, Tiger Woods has a new sponsor. Durex.

  2. Uhh are you making this up? This post is some f-ed up sh*t kid. Ive met braindead chimpanzees who were smarter than you.

  3. In related news, Tiger changed his name to Cheetah.

  4. Wonderful article ! You havemade some very astute observations and I appreciate the the effort you have put into your writing. It is clear that you understand what you are writing about. I am looking forward to reading more of your sites content.

  5. Seriously great details. Im lucky I observed this publish. Thank you for sharing

  6. Keep functioning and excellent work on the posts, We will be restored again as well as look at your give food to away soon.

  7. Hello from the fashion marketplace, I truly value the get the job done you’ve completed in this write-up, it was a fantastic read. I am currently functioning with a brand new venture using the aim to join the fashion marketplace in a single discussion board. I’ve gained a couple excellent tips for my site from reading this.

  8. mfmw vtgqe Free Porn qurzml l re z gnq

  9. zipe cxeil http://www.zackspornlinks.com – Porn Video aqjmui b fc s jrw

  10. You made some good points there. I did a search on the topic and found most people will agree with
    your blog.

  11. i bookmarked this! looking for updates…

  12. Im not going to say what everyone else has already said, but I do want to comment on your knowledge of the topic. Youre truly well-informed. I cant believe how much of this I just wasnt aware of. Thank you for bringing more information to this topic for me. Im truly grateful and really impressed.

  13. very good, added you to my favorites.

  14. zwrot podatku z holandia, praca na terenie holandii, zwrot podatku holandia, odzyskaj zwrot podatku

  15. Your website is not showing up correctly in my browser.

  16. zwrot podatku odzyskaj należny Ci podatek

  17. This blog post gives the light in which we can observe the reality. this is very nice one and gives indepth information. kudos for this great blog post!

  18. Being within the internet affiliate marketing business is not that tough now using the internet at your disposable. It’s a lot simpler now compared towards the days when people have to make use with the telephones and other mediums of information just to obtain the latest updates around the way their plan is coming along.

  19. If you let a bully come in your front yard, he’ll be on your porch the next day and the day after that he’ll rape your wife in your own bed. (On appeasement)

  20. Hey i am suuper boy

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>