Home > Web Front-end > Front-end Q&A > What to do if jsp css doesn't work

What to do if jsp css doesn't work

藏色散人
Release: 2020-12-18 10:11:35
Original
2538 people have browsed it

Solution to jsp css not working: 1. Change the relative path to an absolute path; 2. Add an extra "/'" symbol where external styles or scripts are introduced, and then press "F5" refreshes.

What to do if jsp css doesn't work

The operating environment of this tutorial: Windows 7 system, css3 version. This method is suitable for all brands of computers.

Recommended: "css video tutorial"

External css does not work in jsp

Usually refer to external css styles The relative path is used:

<link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet">
Copy after login

, but when referencing external css styles, it is invalid. The problem can only be with the path.

1. After changing the relative path to an absolute path, there will be no problem.

<link href="${pageContext.request.contextPath}/bootstrap/css/bootstrap.min.css" rel="stylesheet">
Copy after login

${pageContext.request.contextPath} can get the root directory of the project.

2. Solution to the problem that refreshing the browser does not take effect after changing the css:

Add an extra '/' where external styles or scripts are introduced!

Finally refresh the page with F5

What to do if jsp css doesnt work

As long as it doesn’t take effect, continue adding!

The above is the detailed content of What to do if jsp css doesn't work. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template