How to add css style to jsp page

青灯夜游
Release: 2023-01-04 09:37:47
Original
9730 people have browsed it

Methods to add css styles to jsp pages: 1. Use the "<link>" tag in the jsp page to link to the css style sheet; 2. Use the "<style>" tag in the document header in the jsp page Define the internal style sheet; 3. Use the style attribute in the tag element of the jsp page to include any css style.

How to add css style to jsp page

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

Recommended: css video tutorial

There are three ways to insert 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!


【1】External styles
When styles need to be applied to many pages, external style sheets will be the ideal choice. With external style sheets, you can change the look of your entire site by changing one file. Each page links to the style sheet using the <link> tag.

<link rel="stylesheet" type="text/css" href="<%=uiPath%>hwtt_ui/skins/<%=skinName%>/css/login.css" />
Copy after login

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


【2】Internal styles
When a single document requires special styles, an internal style sheet should be used. Internal style sheets can be defined at the head of the document using the <style> tag.

    <style type="text/css">
        .loginBtn{
            display:block;
            cursor: pointer;
            height: 32px;
            margin-bottom: 1px;
            width: 100px;
        }
    </style>
Copy after login

[3] Inline styles
Inline styles lose many of the advantages of style sheets because they mix presentation and 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 type="text" name="authCode" style="vertical-align: middle" />
Copy after login

For more programming-related knowledge, please visit: Programming Learning! !

The above is the detailed content of How to add css style to jsp page. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!