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!
In software engineering, when I was doing Web front-end development and writing jsp pages, I felt that the pages were very ugly. My classmates introduced me to the problem of inserting css to improve the beauty of the pages.
Recommended course: Java Tutorial.
How to introduce the css style sheet file into the jsp page?
First put the written css style sheet content Save as *.css format. For example, style.css
Introduce this css style file into the page. Introduce it in the following way.
<link>
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.
By the way, let’s talk about how to write css styles in JSP pages.
Internal styles
When a single document requires special styles, internal style sheets should be used. Internal style sheets can be defined at the head of the document using the
Add styles using class selectors.
<style> .loginBtn{ display:block; cursor: pointer; height: 32px; margin-bottom: 1px; width: 100px; } </style>
Inline styles
Inline styles lose many of the advantages of style sheets by mixing presentation with content. Use this approach with caution, for example when the style only needs to be applied once to an element. To use inline styles, you need to use the style attribute within the relevant tag. The Style property can contain any CSS property.
<input>
The above is the detailed content of How to reference css in jsp. For more information, please follow other related articles on the PHP Chinese website!

The article discusses using Maven and Gradle for Java project management, build automation, and dependency resolution, comparing their approaches and optimization strategies.

The article discusses creating and using custom Java libraries (JAR files) with proper versioning and dependency management, using tools like Maven and Gradle.

The article discusses implementing multi-level caching in Java using Caffeine and Guava Cache to enhance application performance. It covers setup, integration, and performance benefits, along with configuration and eviction policy management best pra

The article discusses using JPA for object-relational mapping with advanced features like caching and lazy loading. It covers setup, entity mapping, and best practices for optimizing performance while highlighting potential pitfalls.[159 characters]

Java's classloading involves loading, linking, and initializing classes using a hierarchical system with Bootstrap, Extension, and Application classloaders. The parent delegation model ensures core classes are loaded first, affecting custom class loa


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool