can not load the css file

I know this is a very basic question but I cannot deal with it in this situation. I'm using Vertx. When I deploy my verticle which render index.peb file but cannot load the css files.

This is my folder :

folder structure

this is link to css file :

<link rel="stylesheet" href="../statics/css/bootstrap.min.css">

and the error :

WARNING: 0:0:0:0:0:0:0:1 - - [Mon, 17 Feb 2020 03:19:48 GMT] "GET /statics/css/bootstrap.min.css HTTP/1.1" 404 53

Upvotes: 1

Views: 124

Answers (2)

I'm sorry everybody. I presented my question not clearly and I've not read vertx document completely. My CSS file can not be loaded because I don't set the web root folder in router.

Upvotes: 1

campbellg54
campbellg54

Reputation: 66

The problem here is pretty simple, the href attribute in index.peb is referencing the wrong place for your css file.

The ".." means to go up one folder, so href = ../statics/css/bootstrap.min.css never leaves the templates folder and attempts to reference a file at templates/statics/css/bootstap.min.css.

Fixing this is as simple as adding an extra ../ to the start:

<link rel="stylesheet" href="../../statics/css/bootstrap.min.css">

Upvotes: 2

Related Questions