Ant Posted May 11, 2012 Report Share Posted May 11, 2012 Whats the difference between these two items? <img width="120" style="padding:0px 0px 15px 0px; and <img width="120" padding:0px 0px 15px 0px; When I see this width="120" I'm not sure how to add inline css to it. For instance i wanted to add padding to the image but wasn't sure if doing it like this was valid: padding:0px 0px 15px 0px; Here's another example: <table style="width: 800px;" border="0"> Can I do this if I want to define font size: <table style="width: 800px;" border="0" font-size:20px;> Thanks, A. Quote Link to comment Share on other sites More sharing options...
newseed Posted May 11, 2012 Report Share Posted May 11, 2012 (edited) Acceptable: <img width="120" style="padding:0px 0px 15px 0px;" src="url"> Preferred: <img style="width: 120px; padding:0px 0px 15px 0px;" src="url"> Incorrect: <img width="120" padding:0px 0px 15px 0px; src="url"> You can't add padding inline without the using style="" as shown above. 'width' and 'border' are acceptable but preferred to be used within the style="" or external stylesheet. Acceptable: <table style="width: 800px;" border="0"> Preferred: <table style="width: 800px; border:0;"> Incorrect: <table style="width: 800px;" border="0" font-size:20px;> Font size should be contained within the style="". Corrected: <table style="width: 800px; border:0; font-size:20px;"> Edited May 11, 2012 by Eddie Quote Link to comment Share on other sites More sharing options...
newseed Posted May 11, 2012 Report Share Posted May 11, 2012 (edited) To add to my last post, here's the best way to do this using external css stylesheet: HTML: <img class="myimage" src="url"> CSS: .myimage { width: 120px; padding:0px 0px 15px 0px; } HTML: <table class="mytable"> CSS: .mytable { width: 800px; border:0; font-size:20px; } Edited May 11, 2012 by Eddie Quote Link to comment Share on other sites More sharing options...
Ant Posted May 11, 2012 Author Report Share Posted May 11, 2012 Thanks Eddie. You cleared it up for me. I would use external style sheets but these are random needs that I just wanted to adjust using inline. Thanks again, A. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.