Danish Khan Danish Khan -4 years ago 73
CSS Question

id not applying to HTML element for mobile browser

I am facing some problems with css priority on my mobile device. The problem is that css id selector

is not applying to
element. The weird thing is that it is working on my PC browser.

Code not working for mobile device:

/* space between content and navigation */
div #push-content {
padding-top: 60px;

<body id="push-content">

It applied to
element after this

<body style="padding-top: 60px;">

I don't feel like this is the only way. Any other way to fix this?

Answer Source

This is absolutely terrible. I found the problem. My website is powered by wordpress. I was using the wrong link. Basically, I was hosting the website via XAMP on my local PC for testing purposes. I was using the function bloginfo('stylesheet_url'); which gave me nightmares. The stylesheet was not being linked on my mobile phone. It was returning http://localhost:8080/wordpress/ which is the incorrect link for any other device on LAN so I put the IP there and it worked like a charm. I modified it to is the IP of source/host computer ( you can find it by opening command console on windows and write "ipconfig" )

NOTE: You should use bloginfo('stylesheet_url'); function. I removed it temporarily because I was testing my website on other devices via LAN with help of XAMP.

Thank you everyone for helping. I really appreciate it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download