I am making an app with Spring Boot.
I have a Thymeleaf view chat.html in resources/templates/chat.html I include style.css stylesheet in it.
When I load the chat.html in browser only html shows without any stylesheet.
Here is chat.html
<html xmlns:th="http://www.thymeleaf.org">
<head>
<link href="styles/style.css" rel="stylesheet">
<title>Chat Web App</title>
</head>
...some irrelevant html ...
<body>
</body>
</html>
I have put the style.css in resources/static/styles/style.css as per several other answers for same problem but no bueno. Perhaps some additional configuration need to be made or i am simply making a dumb typo.
The issue was actually in my CSS file :) . Apparently i had selectors for classes that werent present in the html. After removing them the solution proposed in the comments worked fine!
Related
I'm opening this because I have an issue with my css in my project he won't load I don't know why I try many things. I'm in JEE Maven project I run this on apache server 9 everything work just css won't charge Sorry if I made typos still learning English.
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" >
<link href="../css/listerEmployer.css" rel="stylesheet">
</head>
It loading in preview but not on the page I don't know why I really need some help.
i have CSS file in one folder,html file in one folder,javascript in one folder. where shoul i link these files and how?whether in html or jsp page.please let me know.. even after giving a link like
where CSS is my folder.
how a proper aggregation is needed in in eclipse considering the industry standards ?
You link the files on your html page in the head of the document.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="../css/main.css">
<script src="../js/main.js"></script>
</head>
...
Some people recommend linking javascript at the end of the document (just before the closing body tag) so that the visible elements can be rendered first before the javascript is parsed.
Just to clarify, css must be in the head; javascript can be anywhere and possibly/probably optimal at the end.
use link element to link various resources to your page like: CSS files, a favorite icon ...
check out this video demo
and script tag (as shown above by Crazysheep) to link scripts
I recently installed the PDF module for Play! 2.0 and was able to wire it up to render a PDF without much difficulty. However, it looks like it's not loading my stylesheet, since no styles get applied to the PDF.
I've tried referencing my stylesheet using the classpath:
<link rel="stylesheet" type="text/css" href="/public/css/pdf.css" media="screen" />
I've also tried referencing it using #routes:
<link rel="stylesheet" type="text/css" href="#routes.Assets.at("css/pdf.css")" media="screen" />
In an attempt to keep it simple, I've included only one style in my stylesheet:
td {
color: blue;
}
If I render as HTML, the text in my table is blue, but if I render as PDF, it's all black.
If this is a known issue, I don't see it anywhere. I'm under the impression this should work, so it seems like I must be missing something or doing something wrong. Can anyone help?
I've also reported the issue here.
I am not sure if this is the only issue, but I wrote about one issue in my book when I wrote about the PDF module for play 1.x.
The CSS you are using (and the default for Play when first generated) is to use media="screen". A PDF is classified as print. You therefore need to set media="print".
media="print"
So it would be
<link rel="stylesheet" type="text/css" href="/public/css/pdf.css" media="print" />
I have the next problem with wicket and standard error handling:
all the css files are stored as java resources, near the html pages.
It's working fine. But, when I added the 404 error handling in the web.xml so that any not-found-url is treating as redirect to my PageNotFound.class - the paths to css in this page are broken. it's writes it as
<wicket:link>
<link rel="stylesheet" type="text/css" href="../../wicket/resource/com.web.common.PageNotFound/css/common.css"/>
</wicket:link>
instead of
<wicket:link>
<link rel="stylesheet" type="text/css" href="wicket/resource/com.web.common.PageNotFound/css/common.css"/>
</wicket:link>
(which is working fine, and appeared if I point directly to this PageNotFound page)
So the questions is - why only when error is handled it adds additional useless "../../" to css path?
I did all as it is described here (HTTP Error pages part): adding custom error pages using wicket
Have a look at https://issues.apache.org/jira/browse/WICKET-3602. This might be the cause of your problem.
How does one apply custom CSS to a HTML report generated using Jasper. I need to include this report as an iFrame into a GWT window.
You can simply include a link tag in your GWT html file like so:
<link type="text/css" rel="stylesheet" href="myJasperStyles.css">
The CSS file should explicitly refer to Jasper-related HTML tags to ensure the CSS won't affect your GWT elements.