Ant Posted May 11, 2012 Report 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.
newseed Posted May 11, 2012 Report 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
newseed Posted May 11, 2012 Report 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
Ant Posted May 11, 2012 Author Report 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now