0

I've run into trouble using my own stylesheet while using Bootstrap. This is the beginning of my header.php (which I import in the beginning of index.php):

<html>
<head>
<link href="includes/css/bootstrap.min.css" rel="stylesheet">
<link href="includes/mystyle.css" rel="stylesheet">

EDIT: I've found out that for some reason I can include the file if it is in the same folder by: <link mystyle.css" rel="stylesheet"> but if I move the folder the includes folder and do as I did in the beginning, for some reason it won't import the stylesheet. Very weird...

  • 1
    Seems to [work as expected](https://www.codeply.com/p/WIpnDEF8F1). Are you sure `mystyle.css` is properly referenced & loaded? What does the other code look like? Is the dropdown inside a navbar or tabs? – Carol Skelly Oct 15 '20 at 12:48
  • 1
    Does the browser console (F12) show errors? – Carol Skelly Oct 15 '20 at 12:56
  • No browser error. It is definitely the connection to mystyle.css that is flawed! I'm sure I referenced it right however. I'll edit the post and show you the code! –  Oct 15 '20 at 12:59
  • I am using it in a navbar indeed, but I don't think this is the problem - I can't even give body attributes, so I dont think mystyle.css is included. I just don't know why. –  Oct 15 '20 at 13:16
  • 1
    Info on relative paths: https://stackoverflow.com/questions/17621324/relative-path-to-css-file – disinfor Oct 15 '20 at 13:26
  • Thank you. Not sure how to 'close' the thread, but I think it's solved (for now, I'll just move the file, and I'll investigate css paths further later) –  Oct 15 '20 at 13:29

2 Answers2

1

You might have to use a more specific selector or use !important (less recommended).

Try setting an id for your menu, lets say my-menu. Then, change the selector:

#my-menu {
  width: 300px;
  height: 400px;
}

If you don't want to use an ID, try adding !important:

.dropdown-menu {
  width: 300px !important;
  height: 400px !imporatnt;
}
Sagi Rika
  • 2,839
  • 1
  • 12
  • 32
  • Thank you, I actually did that, just made a mistake posting the post. –  Oct 15 '20 at 12:41
0

I solved it by putting the file out of includes. I tried later putting it in the includes file again and reference it by <link href="includes/mystyle.css" rel="stylesheet">, and now it works. It might've been an spelling error. Case closed!