I just think, when we create a a padding of an element, that means we have to re-calculates the width so as not to exceed what we want, because adding a padding means adding the width as well. It isn't effective for me. So what should we do to create an effective a padding of an element, without having to re-calculates the width?
Yesterday, finally I found the way. I called it "padding tweaker". It's not a library, it's just a hack. It's very easy, I think, and you can understand it soon.
First, create the element you want to add padding. For example, I create a div element with 100px width. Then, created another element inside the first element. For example :
The first element is the element you want add padding. The second element is the padding tweaker. Next, add margins the second element (the padding tweaker), to create a padding effect. For example, I want to make 10px padding.
Only one thing is a shortage of this method, the code becomes longer. But it's better than having to recalculate the width. That's all, see you in the next post!
Yesterday, finally I found the way. I called it "padding tweaker". It's not a library, it's just a hack. It's very easy, I think, and you can understand it soon.
First, create the element you want to add padding. For example, I create a div element with 100px width. Then, created another element inside the first element. For example :
<div style="width:100px;"> <div></div> </div>
The first element is the element you want add padding. The second element is the padding tweaker. Next, add margins the second element (the padding tweaker), to create a padding effect. For example, I want to make 10px padding.
<div style="width:100px;">
<div style="margin:10px;"></div> </div>
And all done! The result is same as the code below :
<div style="width:80px; padding:10px;"></div>
Only one thing is a shortage of this method, the code becomes longer. But it's better than having to recalculate the width. That's all, see you in the next post!
0 komentar:
Posting Komentar