How to introduce css into jsp

藏色散人
Release: 2023-01-05 16:12:55
Original
5201 people have browsed it

How to introduce css into jsp: 1. Use the href attribute in the link tag to introduce the css file path; 2. Use the internal style sheet to introduce css; 3. Inline style to introduce css.

How to introduce css into jsp

The operating environment of this article: Windows 7 system, CSS3 version, Dell G3 computer.

There are three ways to introduce CSS styles into JSP pages, and their priorities are different. The details are as follows: external style, internal style, and inline style. The priority increases in order!

  • jsp can use the href attribute in the link tag to introduce the css file path.

First save the written css style sheet content in *.css format. For example, style.css

introduces this css style file into the page. Introduce it in the following way.

<link rel="stylesheet" href="./css/style.css" type="text/css">
Copy after login

The href="./css/style.css" here refers to the path where the css file is stored. '.'Requests the current directory (that is, the same directory as the jsp page that introduces the css file)

The rel attribute specifies the relationship between the current document and the linked document. In this example, the rel attribute indicates the linked document. is a style sheet.

Two other ways to use css in jsp:

  • Internal style

When When a single document requires special styling, an internal style sheet should be used. Internal style sheets can be defined at the head of the document using the