Home >Web Front-end >Front-end Q&A >How to type css code in jsp

How to type css code in jsp

藏色散人
藏色散人Original
2021-02-01 09:56:492208browse

How to write CSS code in jsp: 1. Use the c9ccee2e6ea535a969eb3f532ad9fe89 tag to define an internal style sheet at the head of the document and write the CSS code; 2. Use the style attribute to write in the relevant tags css code.

How to type css code in jsp

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

There are two ways to write css code in jsp:

Internal style: Use the c9ccee2e6ea535a969eb3f532ad9fe89 tag to define an internal style sheet at the head of the document, write css code

Inline style: Use the style attribute to write css code within the relevant tag.

1. 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 c9ccee2e6ea535a969eb3f532ad9fe89 tag.

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

Recommended: "css video tutorial"

2. Inline style

Because the performance and content must be mixed together, inline style Many advantages of style sheets will be lost. 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" />

In fact, there is another way (recommended) to add css styles in jsp, which is external style

External style:

When the style needs to be applied to many pages, An external stylesheet would be ideal. 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 2cdf5bf648cf2f33323966d7f58a7f3f tag.

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

The three methods of inserting CSS styles into JSP pages have different priorities. The details are as follows: external style, internal style, and inline style. The priority increases in order!

The above is the detailed content of How to type css code in jsp. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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