Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By akandersen on
When I add an image to a block, Drupal automatically adds p tags around it, pushing the image down. Any suggestions on how to remove these p tags as they cause the image not to be aligned correctly?
This is the code I've added to the block:
<img src="sites/default/files/bannerimages/lassa.jpg">
And you can view the problem here:
http://s357151536.onlinehome.us/lassa_fever
(The image at the top should be centered within the blue area.)
Many thanks!!!
Comments
This is dependent on the
This is dependent on the input format that your block uses.
For the paragraph tags to not be added - you will need to use an input format that does not include the "Lines and paragraphs break automatically" setting.
My site: http://julian.granger-bevan.me
Maintainer of: Drupal PM (demo)
As far as I can tell Drupal
As far as I can tell Drupal only offers two input formats - Filtered and Full HTML, and both come with the "Lines and Paragraphs break automatically" setting. Am I missing something?
Add a new one
You can add a new input format and call it "Raw HTML", "wysiwyg", or something similar, and leave all checkboxes unchecked under Filters. Use this format for your block and all should be ok.
Cheers,
--
hook_world() is broken.
This problem arose after I
This problem arose after I attempted to install a custom theme I had developed by a company that specializes in converting PSD designs into Drupal themes. The images align perfectly on the development site where the input format is set to Full HTML (and no p tags appeared).
Is there's something within the CSS that could control the appearance of the p tag? I'm reluctant to start installing new input formats when it worked perfectly in Full HTML the first time around.
Creating a new input format
Creating a new input format is really not a big thing, and having an input format that doesn't make any modifications to the input is always good to have. If I remember correctly, the Full HTML format always add a p tag, unless the settings for the format has been changed.
You can change this with CSS if you'd like. Just add this line in any of your .css files (probably style.css):
Cheers
--
hook_world() is broken.
Worked like a charm!
Created the new input format and it works like a charm now. Thanks!
Glad I could help. :)
Glad I could help. :)
--
hook_world() is broken.
Another way is you can
Another way is you can download and activate the display suite module. It'll then give you another option to use display suite code.