Insert and image after a paragraph but before the next paragraph
I want to insert a image after a paragraph but before the next paragraph.
I generated the elements and used insertBefore() to insert the image after a paragraph element.
Problem is that i cannot get the image to sit in the space after the first paragraph and before the next without padding or margins around it.
For example,
rather than this:
this is a paragraph
this is a image
this is another paragraph
I want this:
this is a paragraph
this is a image
this is another paragraph
Hope this makes sense. I set the image CSS to vspace 0 and hspace 0 padding 0 and margin 0
Any ideas.
decibel.places posted this at 20:17 — 3rd May 2009.
He has: 1,494 posts
Joined: Jun 2008
you can override the default margin settings for the p tag:
(see attached)
<style>
p {margin: 0}
</style>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sed turpis. Sed metus turpis, tristique at, feugiat et, tincidunt eu, leo. Praesent laoreet? Quisque vestibulum iaculis felis! Morbi sem. Nam egestas. Nam in neque nec eros feugiat blandit. Donec condimentum, lorem at luctus mattis, nunc ante porta velit, commodo pellentesque nibh sem ac est. Integer tempor lobortis elit. Maecenas vitae lorem. Ut fringilla enim vitae ligula! Ut interdum purus quis massa. Vestibulum faucibus porttitor ipsum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Integer nisl augue, vulputate et, gravida vel, mattis ac, quam! Nulla ligula erat; tincidunt sed, pulvinar vel, lobortis et, ipsum. Nullam eu eros. Duis eget diam aliquet enim viverra condimentum. Sed id nibh. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
<img src="http://www.webmaster-forums.net/files/pictures/picture-1018260.png">
<p>Phasellus quis magna et elit luctus ullamcorper. Integer lorem lacus, auctor id, pellentesque non, facilisis lacinia, enim. Nam semper! Nullam ac enim quis nibh hendrerit auctor. Morbi suscipit, est sed pulvinar ultricies, orci nisl porttitor purus, sed dignissim sem nisi eget justo. Nullam dictum egestas erat. Proin tristique, mauris rhoncus laoreet facilisis, enim turpis semper sapien, quis sagittis quam turpis vel arcu. Vivamus mollis magna nec turpis. Sed tempor urna non libero condimentum porttitor. Aliquam tincidunt metus vitae lorem. Phasellus imperdiet ligula in sem. Sed iaculis enim nec massa sodales lacinia? Sed diam dolor; lacinia ut, ornare quis, pellentesque ac, lacus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla venenatis, massa nec gravida eleifend, orci lacus laoreet velit; ut imperdiet purus est vitae lectus. Mauris metus. Phasellus vitae lectus. Curabitur adipiscing quam nec neque.</p>
OR, you could use Drupal... (kidding! )
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.