-
AuthorPosts
-
March 19, 2016 at 9:52 am #600647
Hi — I’m adapting some elements for mobile but the CSS in the documentation doesn’t seem to work for me. I’ve reduced it down to the simplest of requests below (in custom.css) but all the images still show up on mobile browsers:
@media only screen and (max-width: 767px) { img { display: none !important; } }
March 20, 2016 at 4:11 am #600801Hey benrroberts!
Thanks for reaching out to us!
Could you please provide a link to your site and login details if possible so we can have a closer look. You can place the details in the Private Content section of your reply.
Cheers!
JordanMarch 22, 2016 at 11:01 am #601808Hi Jordan,
I’d prefer to fix it myself unless I need a last resort. I think the initial issue was due to caching or the like as after a couple of hours the images had disappeared. Well every image on the page except the colour section background which is what I want removed & I guess isn’t captured under the img tag?
So I modified the code to try to achieve the removal of just the colour section background per the below, where I’ve named the colour-section as ‘background-image-responsive’ but it hasn’t worked (and other images returned so I know the code has processed). Any ideas for me?
@media only screen and (max-width: 767px) { .background-image-responsive { display: none !important; } }
March 22, 2016 at 5:10 pm #601988Hi!
Can you please post the content of your custom CSS here using http://pastebin.com/ so we can check if you have error in your custom CSS?
Also, can you please post the link to your website and point out the image you would like to remove?Regards,
YigitMarch 28, 2016 at 11:08 pm #604153March 29, 2016 at 12:28 pm #604424Hi!
you are talking about the “From Hasty to Tasty” image, right? use this code instead:
@media only screen and (max-width: 767px) { #background-image-responsive { display: none !important; } }
Best regards,
AndyMarch 29, 2016 at 12:29 pm #604426no, use this one instead please:
@media only screen and (max-width: 767px) { #background-img-responsive { display: none; }}
Cheers!
AndyMarch 29, 2016 at 2:37 pm #604561Hi Andy,
Thnaks – that indeed made the background hasty-to-tasty image stop displaying!
If I want to now display a separate background image there for mobile devices should I use ‘ content:”url” ‘ instead of ‘ display: none ‘ or is there a better way to do this?
Thanks,
BenMarch 29, 2016 at 2:44 pm #604565Hey!
You can refer to this thread to display different elements on mobile and on desktop – http://kriesi.at/documentation/enfold/hide-menu-itemselements-on-mobile/
Best regards,
YigitMarch 29, 2016 at 3:24 pm #604623Hi Yigit,
The referred thread doesn’t really add anything here — I’d already hid the background image with Andy’s code above. I’d actually like to have the ability to replace the background image of a colour section with another image for mobile (as the text is cut off otherwise). I’m worried this isn’t fully possible so interested in your thoughts, as currently when the mobile image version displays it has removed the button that sits in that colour section for desktop.
Here’s my set-up on the homepage in WP:
Desktop = colour section w/ From Hasty to Tasty graphic + a button inside it
Mobile = if I run below in CSS I get a replacement image but no button.@media only screen and (max-width: 767px) { #background-img-responsive { content:url(“https://gastronoms.com.au/wp-content/uploads/newimage.jpg”); } }
I’d like to know if possible a) if I can replace the image in mobile AND have the button remain & b) whether the content:”url” code is best practice?
Ben
March 30, 2016 at 5:44 am #604948Hi,
I’m not sure if I understood your problem correctly or not but could you try to create another section to show for mobile only? You can then give your sections IDs and hide/show the correct one using CSS:
@media only screen and (max-width: 767px) { #desktop-section { display:none !important; } } @media only screen and (min-width: 768px) { #mobile-section { display:none !important; } }
Thanks,
RikardMarch 30, 2016 at 12:58 pm #605124Thanks Rikard — that code appears to have worked!
Ben
March 30, 2016 at 7:07 pm #605381Hey!
glad we could help. Let us know in a new ticket if you have some more questions related to the theme. We are happy to assist you.
Best regards,
Andy -
AuthorPosts
- The topic ‘Mobile responsiveness CSS not working’ is closed to new replies.