Advertisement Management

CSS not working anymore? - Advertisement Management

CSS not working anymore?

by Webmasterks » Tue Jan 30, 2018 4:40 pm

I just updated the extension and with my banners, I had CSS in the code to style the container the ad is in, but now that doesn't seem to work anymore. Can we not style the ad container anymore?

Like this:

Code: Select all

<style>

.advert {
    background-color: #eeeeee;
}

.phpbb-ads-center {
   display: block;
   text-align: center;
   padding: 10px 0;
}

</style>

<div class="advert"><a href="https://www.example.com" rel="nofollow" target="_blank"><img src="https://www.example.com/image" alt="" style="max-width:100%; height:auto; border:none; padding: 7px 0;" /></a>

</div>
Webmasterks
Registered User
Posts: 275
Joined: Tue May 27, 2003 11:28 pm
Location: The Hague, The Netherlands
Contact:

Re: CSS not working anymore?

by Senky » Fri Feb 16, 2018 9:20 am

Webmasterks,
you can always style the ad container. Just make sure your code has higher priority than the original one.

Regarding your code, I tried it in Chrome and instead of new CSS definitions, contents of <style> tag is printed as a text. I have no idea why, because in HTML5 you are allowed to use <style> in the body...
‎‏‏ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎ ‎‏‎‏‏‎ ‎ ‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎🔔
Browser & Mobile Notifications Extension
Now with Safari (both macOS and iOS) support!
Senky
Former Team Member
Posts: 2300
Joined: Thu Apr 30, 2009 8:49 pm
Name: Jakub
Contact:

Re: CSS not working anymore?

by Webmasterks » Fri Feb 16, 2018 10:08 am

I know, I got the same result. To get what I wanted, I put this in the phpbbads.css:

Code: Select all

.phpbb-ads-center {
	text-align: center;
	display: block;
	padding: 10px 0;
}

.phpbb-ads-center > :first-child {
	display: block;
	max-width: 100%;
	background-color: #eeeeee;
}
Maybe not the best way of doing it, but it works.
Webmasterks
Registered User
Posts: 275
Joined: Tue May 27, 2003 11:28 pm
Location: The Hague, The Netherlands
Contact:

Re: CSS not working anymore?

by MattF » Fri Feb 16, 2018 4:17 pm

Try to use !important to force your styling too.
Formerly known as VSEMy ExtensionsPlease do not PM me for support.
User avatar
MattF
Extensions Development Coordinator
Extensions Development Coordinator
Posts: 5861
Joined: Sat Jan 17, 2009 9:37 am
Location: Los Angeles, CA
Name: Matt Friedman
Contact:

Re: CSS not working anymore?

by Webmasterks » Sat Feb 17, 2018 8:08 am

Thanks, I've never used that, but I'll look into it.
Webmasterks
Registered User
Posts: 275
Joined: Tue May 27, 2003 11:28 pm
Location: The Hague, The Netherlands
Contact: