Page 1 of 1

XAMPP doesn't seem to like some of my CSS

PostPosted: 29. October 2020 12:33
by KarenC996
Hi, I am trying to run some html code with a line of php in to test an included php file. The php section worked fine but I noticed that two elements of my webpage had been ignored by Apache. These showed up fine when I previewed them in notebook++. I'm wondering if Apache objected to hashtags in associated css file but if so why only for those two elements? It displayed all the others without any issue and the css contained hashtags for them too.
The html and corresponding css codes for the affected elements are shown below.

HTML
<div id="adbox1"><p>adbox1</p></div>
<div id="adbox2"><p>adbox2</p></div>

CSS
div#adbox1{
position:absolute;
top:50%;
left:85%;
height:130px;
width:140px;
border:thin solid;
}
div#adbox2{
position:absolute;
top:95%;
left:85%;
height:110px;
width:190px;
border:thin solid;
}
If you can see any issue with above coding could you let me know please? I am completely baffled why Apache discriminates against those two elements. :?

Re: XAMPP doesn't seem to like some of my CSS

PostPosted: 29. October 2020 13:38
by Nobbie
Apache does not "ignore" CSS; it also does not interprete CSS. CSS is interpreted by the browser, Apache knows nothing about CSS. Apache simply delivers the HTML File.

I dont know if you misplaced CSS or HTML in your code, as we do not see the full HTML code. But it is definately not an Apache issue, neither Xampp.

P.S.: OMG!!!

That took me a whole hour. I tried to run a simply HTML Script with your CSS Code and - i could see the boxes for a second, then they disappeared. I tried everything, i used "class" instead of "id", i used different Ids (instead of "adbox1" etc.) and ... it worked!! WHY???

I got it now: I have an Adblocker installed and running, This Adblocker removes the boxes!!!! Rename your ids from "adbox" to anything else and it works! O my god...

Re: XAMPP doesn't seem to like some of my CSS

PostPosted: 29. October 2020 14:34
by Altrea
Are all your assets (css, is, images, etc.) requested successful? Check for example with help of the chrome web developer tools.

If this part not working is somewhare related with the php code part then please check if your file extension is .php and not .html

Check if your browser renders localhost code different then online URLs (mostly the internet explorer will change in someway of quirks compatibility mode for localhost resources.

Re: XAMPP doesn't seem to like some of my CSS

PostPosted: 29. October 2020 14:41
by Nobbie
See my "P.S."!!

Re: XAMPP doesn't seem to like some of my CSS

PostPosted: 29. October 2020 17:02
by KarenC996
Cheers for the replies, I will change some of element names and see if that has any effect. All my other images etc that I have styled in css have been successful so I will presume problem just lies in definition of those two elements. Its first time I've ever used xampp so I didnt really know what to expect from it.

Re: XAMPP doesn't seem to like some of my CSS

PostPosted: 29. October 2020 18:10
by Altrea
KarenC996 wrote:Its first time I've ever used xampp so I didnt really know what to expect from it.

It is still not an XAMPP issue.

Re: XAMPP doesn't seem to like some of my CSS

PostPosted: 30. October 2020 16:11
by KarenC996
Whoever suggested I change some div names; cheers, I tried that and it worked a treat. :)

Re: XAMPP doesn't seem to like some of my CSS

PostPosted: 30. October 2020 21:21
by Nobbie
"Whoever" is me and that took me a lot of work to find out that really weird behaviour and the reason for it. Feel free to tip me properly.... ;)

Re: XAMPP doesn't seem to like some of my CSS

PostPosted: 30. October 2020 22:13
by KarenC996
Cheers!!