Use CSS to replace indexing HTML tags without using replace

Source: Internet
Author: User
Tags html tags xslt

In fact, CSS is also a powerful tool for separating HTML from data and performance. Stone CSS Oriented Design: COD is very suitable for my taste. It is not easy to get rid of Table Oriented Design. But once it is realized, the system itself achieves division of labor and collaboration: you can change your skin like Winamp, so as to exert your greatest initiative. The most direct example is the MT system used on the website. All styles come from MovableStyle ,.
Requirement: <B> in the XML result set is displayed in red. In fact, it can be implemented through the CSS of the client:
The code is as follows:
First
<Blockquote>
Use CSS to replace <B> indexing </B> HTML tags without using replace
</Blockquote>
Use CSS to replace <B> indexing </B> HTML tags without using replace
In this way:
Defined in CSS: B {color: red ;}
In addition to bold, all <B> are marked with red attributes. To prevent other <B> values on the page from being marked with red, I put the results in one <B>
Blockquote>
And then define in CSS:
<Style> <! --
Blockquote B {color: red ;}
// -->
</Style>
Because of the inheritance relationship of CSS, only <B> in blockquote will be marked with red:
Font-weight: normal can even reduce the font size.
Through this question: draw two conclusions
1. When designing an external search service with indexing, you can use <B> as a marker.
2. On the client side, you can use CSS to implement control.
About: CSS, Accesibility and Standards Links
Postscript:
I have been pursuing the concept of separation of data, structure, and performance in XML, XSLT, and CSS for a while. However, the implementation cost of XSLT is indeed relatively high. Therefore, Resin has developed the XHTML-based lightweight template technology, and I think the implementation of ASP. net is similar.
There may be no best mode, but only the most appropriate mode: The key is to check the complexity of development.
Hundreds of lines of code may have the highest procedural programming efficiency;
Thousands of lines of code may be the most efficient for function development;
When there are tens of thousands of lines of code, it may have to be OO;

Related Article

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.