Danish Khan Danish Khan - 3 months ago 9
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

push-content
is not applying to
body
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
body
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

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 http://192.168.1.8:8080/wordpress/ 192.168.1.8 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.