Support Forum

Please note that this forum is only available to you in read only mode. In order to contribute to this conversation you will need to renew your subscription.

@media not working

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Hi - I'm trying to centre a logo on smartphones only and I can't get it to work.
This is the site: www.financingfirst.co.uk/joomla3
And this is the css:
@media only screen and (min-device-width : 320px) and (max-device-width : 480px)
{
.mobcenter
{
display:block !important;
margin-left:auto !important;
margin-right:auto !important;
text-align:center !important;
}
}

Any idea where I'm going wrong?

Thanks

Ian
  • ianpanorton's Avatar
  • ianpanorton
  • 6 Month Developer
  • 1258 posts
  • 3 Thanks
  • Karma: 7
The administrator has disabled public write access.
Hi Ian,

what is it targeting on the site?

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
Hi Paul - Thanks for getting back to me.

I don't think it's targeting anything… I suppose it ought to be the home page…

Why?

Ian
  • ianpanorton's Avatar
  • ianpanorton
  • 6 Month Developer
  • 1258 posts
  • 3 Thanks
  • Karma: 7
The administrator has disabled public write access.
Hi Ian,

What area of the site is it supposed to be targetting?

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
Ah - I always was good at explaining myself!

Sorry Paul, it's the FinancingFirst logo, top left…

Thanks

Ian
  • ianpanorton's Avatar
  • ianpanorton
  • 6 Month Developer
  • 1258 posts
  • 3 Thanks
  • Karma: 7
The administrator has disabled public write access.
Hi Ian,

Well first thing you do have

element.style {
padding-top: 25px;
}

this won't affect the centering but will stop any media query working if you did want to target it
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
Also you do have two brackets at the bottom of the site so those need to be removed if you wanted any style to work after those tags

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
I think you have a few things going on - the image is full width of the available space so it can't center as it can't move

Also you would need to target the img

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
Hmmm. I've removed the padding, but the logo is still not centring on the phone…

Thanks for spotting the two brackets - I'm getting tired :-)

Ian
  • ianpanorton's Avatar
  • ianpanorton
  • 6 Month Developer
  • 1258 posts
  • 3 Thanks
  • Karma: 7
The administrator has disabled public write access.
Hi Ian,

I added some more comments after that
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
Hmmm. I've added the class mobcenter to the image, and extended the position, but it's still not working for me.
I'm not doing well today,
Thanks
Ian
  • ianpanorton's Avatar
  • ianpanorton
  • 6 Month Developer
  • 1258 posts
  • 3 Thanks
  • Karma: 7
The administrator has disabled public write access.
"the image is full width of the available space so it can't center as it can't move"

this is the issue at the moment ignoring any code you have added

Cheers
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
I've made the image much smaller, and the position top 1 is now full width…

And it's worked!

If I wrap the logo and text in divs and float them left and right, will that stop the @media working?

Thanks

Ian
  • ianpanorton's Avatar
  • ianpanorton
  • 6 Month Developer
  • 1258 posts
  • 3 Thanks
  • Karma: 7
The administrator has disabled public write access.
Yes it does,
  • ianpanorton's Avatar
  • ianpanorton
  • 6 Month Developer
  • 1258 posts
  • 3 Thanks
  • Karma: 7
The administrator has disabled public write access.
Not to worry I'll sort it out tomorrow.

Many thanks for your help today Paul.

Best wishes

Ian
  • ianpanorton's Avatar
  • ianpanorton
  • 6 Month Developer
  • 1258 posts
  • 3 Thanks
  • Karma: 7
The administrator has disabled public write access.
No problem

Good luck with it

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Happy Campers