my css level after ~3 yrs at navarik

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. Thanks for putting this information up. This is EXACTLY what I

  2. Without difficulty, the post is really the best on this deserving topic. I agree with your results and will thirstily look onward to your approaching updates. Saying many thanks will not just be enough, for the tremendous ability in your writing. I will instantly pick up your rss feed to stay privy of any updates. Very good work and a lot success in your future!

  3. Almost everybody develops hair thinning at any stage of life. In most instances, hair thinning happens to be temporary and individuals regain hair after few weeks to months. In particular instances, hair thinning is unpreventable and turns to complete hair loss or baldness.

  4. fascinating matter, i by no means seen one thing about this earlier than

  5. Hi fellas! :) I’m thinking if a person may possibly help me out! Basically I wish to view this unique web blog with my own new iPad, however it does not present up effectively, So I was asking yourself if a person can propose me any optimal answer? I don’t know but must I attempt and discover out an replace for my software package plan or anything at all else? I know this can be a thing kinda off the topic, but please update me and many thanks in advance for the aid! Sophie :)

  6. Excellent read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that: Thanks for lunch!

  7. Beautiful subtle post. Never considered that it was this simple. Extolment to you!

  8. An ounce of patience is worth a pound of brains.

  9. Superbly composed opinion, thanks mate!

  10. Hello fellows! :) I am questioning if an individual can help me out! Basically I desire to check out this particular webpage at my own latest iPad, but it doesn’t display up properly, So I used to be asking yourself if someone can suggest me any optimal remedy? I do not know but need to I try and uncover out an replace for my software plan or anything else? I am aware that is a thing kinda off the subject, but please replace me and thanks much upfront for that help! Sophie :)

  11. Hi, i just thought i’d post and let you know your blogs layout is really messed up on the K-Melonbrowser. Anyhow keep up the good work.

  12. very good, added you to my favorites.

    by Emprestimo

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>