Getting border width with jQuery

Say the HTML is this

<div id="mydiv" style="border:10px solid #ff0000;">Hello World</div>

then you get the width of the border with this:

var borderWidth =($("#mydiv").outerWidth() - $("#mydiv").width()) / 2;
DeliciousTwitterFacebookLinkedInRedditSlashdotTechnorati FavoritesDiggShare
This entry was posted in HTML, JavaScript. Bookmark the permalink.

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> <pre lang="" line="" escaped="" highlight="">