Summary of three methods for inserting css styles on the jsp page

Source: Internet
Author: User

1. External Style

When a style needs to be applied to many pages, the external style sheet is ideal. When using an external style sheet, you can change the appearance of the entire site by changing a file. Use the <link> label to link to the style sheet on each page. <Link> tag in (document) header:

<Head>
<Link rel = "stylesheet" type = "text/css" href = "path/myCss.css"/>
</Head>

2. Internal Style

When a document requires a special style, you should use an internal style sheet. You can use the <style> label to define an internal style sheet in the document header.

<Head>
<Style type = "text/css">
Style
</Style>
</Head>

3. inline Style

Because we need to mix the performance and content together, inline styles will lose many of the advantages of style sheets. Use this method with caution. For example, when a style only needs to be applied once on one element. To use inline Styles, you must use the style attribute in the relevant labels. The Style attribute can contain any CSS attribute.

Inline styles have the highest priority, followed by internal styles. External styles have the lowest priority.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.