40043mo Posted December 1, 2007 Share Posted December 1, 2007 Just to help you guys think about some of the more basic aspects of markup and to help us newbies solve someelemental problems:Do you add margins to <img> with the <span> tag? I tried that but got no result.What would be really cool would be a short tutorial of what can be done with the <img> tag beyond alt and title.Your assistance would be GREATLY appreciated. Link to comment Share on other sites More sharing options...
Ingolme Posted December 1, 2007 Share Posted December 1, 2007 With CSS you can to everything. You use the style attribute to add CSS.For example:<img src="something" alt="alternate text" style="display: block; margin: 20px;" /> Link to comment Share on other sites More sharing options...
40043mo Posted December 1, 2007 Author Share Posted December 1, 2007 With CSS you can to everything. You use the style attribute to add CSS.For example:<img src="something" alt="alternate text" style="display: block; margin: 20px;" />Cool, thanks!Can you specify margin on just one side?: style="margin-left:20px;" without the display:block; attribute, or is it essential. Link to comment Share on other sites More sharing options...
Ingolme Posted December 1, 2007 Share Posted December 1, 2007 I usually avoid working with margins and padding in inline elements.You can use margin-left, margin-right, margin-top and margin-bottom. Or all of them at once like this:margin: 10px 5px 5px 2px;margin: top right bottom left; Link to comment Share on other sites More sharing options...
Coolguy Posted January 15, 2008 Share Posted January 15, 2008 If you want you can add a class to use multiple times (this saves having to write lots of style="" tags. <!--Insert this into the <head> section--><style type="text/css">.withmargins {margin: 10px 5px 5px 2px;}</style>This goes into the <body><img class="withmargins" src="" /> <!-- This has margins --><img class="withmargins" src="" /> <!-- This has margins --><img src="" /> <!-- This doesn't have margins --><img class="withmargins" src="" /> <!-- This has margins --> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.