Embeded style attribute in div tag Topic is solved

Everything to do with Joomla! 3.x templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
hernacar
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Sep 28, 2011 2:57 am

Embeded style attribute in div tag

Post by hernacar » Tue Apr 13, 2021 6:22 am

Hello,

I'm building a custom template for my website and I am encountering an issue when adding captions to both the intro image and full article image. Using version 3.9.25.

I am running the site on my laptop via localhost, meaning it's not live, so I can't provide a link to it.

Using the Web Developer tool in Firefox, I have found that the <div> tag with the class "image_caption none" has an embedded style attribute in it, which makes any CSS rules defined in the style sheet useless.

This is the code in the full article view. The code in the featured view is similar, except the width is 326px.

Code: Select all

<div class="image_caption none" style="float:none; width:652px;">...</div>
This, like I said, overrides any styles set in either the CSS file, or in the <style> section of index.php.

I am assuming that I will need to edit one of the core files that generates the code? If so, which one?

Thanks in advance for any assistance.
Last edited by hernacar on Tue Apr 13, 2021 7:05 am, edited 1 time in total.

hernacar
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Sep 28, 2011 2:57 am

Re: Embeded style attribute in div tag

Post by hernacar » Tue Apr 13, 2021 7:02 am

Okay, I think I solved it by adding the "!important" flag to the width property in the CSS code.

Code: Select all

div.img_caption {
         width:100%!important
}
However, it seems rather odd that the application would add the style attribute to the tag.


Post Reply

Return to “Templates for Joomla! 3.x”