Saturday, April 14, 2018

Self Mission

OK, so this blog has been stale for so long that i do not wish to disclose "how long" i am talking about.

So, I was watching the Julie and Julia movie and thought so self, this is a real good plan, expect for taking a sick leave from office and posting about it online part, lets give it a try.

Hence, I have challenged myself to post a blog post at least once a week till end of this year.
As they say in Mission Impossible movie, "Good morning, Mr. Hunt. Your mission, should you choose to accept it, involves posting a blog post once a week till Christmas. This message will self-destruct in five seconds"

Friday, March 2, 2018

Why and When to use Padding vs. Margin


To me the biggest difference between padding and margin is that vertical margins auto-collapse, and padding doesn't. Consider two elements one above the other each with padding of 1em. This padding is considered to be part of the element, and is always preserved. So you will end up with the content of the first element, followed by the padding of the first element, followed by the padding of the second, followed by the content of the second element. Thus content of the two elements will end up being 2em apart.

Now replace that padding with 1em margin. Margins are considered to be outside of the element, and margins of adjacent items will overlap. So in this example you will end up with the content of the first element followed by 1em of combined margin followed by the content of the second element. So the content of the two elements is only 1em apart.

This can be really useful when you know that you want say 1em of spacing around an element, regardless of what element it is next to.




The other big difference is that padding is included in the click region and background color/image, but not the margin. Hence padding can be used to add more space around the anchor text of a text link in order to be better clickable on handheld devices; this cannot be done with margin since it adds space outside of the box where the contents (the anchor text) lie.

Since margin is on the outside of block elements while padding is on the inside, I tend to follow these usage guidelines:

  • Use margin to separate the block from things outside it
  • Use padding to move the contents away from the edges of the block.
TL;DR: By default I use margin everywhere, except when I have a border or background and want to increase the space inside that visible box.
 


Margin Padding
1  considered to be outside of the element considered to be part/inside of the element
2  vertical margins auto-collapse They do not collapse, never!!
3  Its outside the element, so wont work like this included in the click region and background color/image




2014 - Year of Custom ROM's

Hello!!
I see there are no posts for a full year. That's bad, it shows I  haven’t learnt anything new. But thats not completely true. I have been abusing my 18month old Sony Xperia-U with a variety of custom roms.

It all started with the unlocking problems; that button got so broken that i was barely able to use my mobile. Cutting the chase, i have used below OS so far.