Tapatalk

Highlighting text inside HTML tag

Highlighting text inside HTML tag

2
NewbieNewbie
2

    Sep 27, 2009#1

    I'm trying to figure out how to get text inside of an HTML tag highlighted. Did some searching didn't find an answer.

    For example: <table width="300px" class="highlightme">

    How do I get the 'highlightme' part to be highlighted?

    236
    MasterMaster
    236

      Sep 27, 2009#2

      <edit>Removed this incorrect and speculative post. Mofi, please delete :)</edit>

      6,685587
      Grand MasterGrand Master
      6,685587

        Sep 27, 2009#3

        The default wordfile html.uew for syntax highlighting HTML content has at top the line:

        /L3"HTML" HTML_LANG Nocase Noquote Block Comment On = <!-- Block Comment Off = --> File Extensions = HTM HTML ...

        Noquote means do not search for strings and highlight them with the color for strings. The reason is quite simple, in HTML often all attribute values are double quoted and with enable highlighting of strings also the standardized values of attributes would be highlighted as strings.

        Well, for my HTML files I have enabled highlighting of DOUBLE QUOTED strings by using following in my HTML wordfile:

        /L3"HTML" HTML_LANG Nocase Block Comment On = <!-- Block Comment Off = --> String Chars = " EnableMLS File Extensions = HTM HTML ...

        UltraEdit and UEStudio highlights for me everything between two double quote characters with the strings color, even when such a string starts on line X and ends on line Y because the values of alt=, title= and others are sometimes so long that I write them over multiple lines.

        But this highlighting is fine for me only because I never use double quote characters for standard attribute values or within the text displayed later in the browser. I use " when I need a double quote character in the displayed text. In HTML 4.01 specification is defined that numbers and string values containing only letters, digits and some other characters must not be quoted. Of course for most attributes the string value must always start with a letter. For details see quotation marks around attribute value in the HTML 4.01 standard. And I use this freedom and double quote only class names, URIs, anchor names, alternate text and title text. And when I must quote a value, for example when using a percentage value for the width attribute, I quote them with single quotes, for example width='50%'. According to my syntax highlighting definition single quoted strings are not highlighted by UE/UES and therefore I get 50% highlighted as number.

        By the way: width="300px" is invalid HTML and therefore ignored by the browsers when using STRICT mode. I know many, many WYSIWYG HTML editors output width and height length values with the unit px into HTML files which is the reason why I think that most programmers of WYSIWYG HTML editors have never read the HTML specification. HTML supports only 3 type of length values for the width and height attributes: just a number (= pixel value) quoted with double or single quotes or not quoted, or a quoted percentage value with % after the number, or a quoted relative number with a * after the number. "px" is a CSS unit and not allowed in any length value of an HTML attribute.
        Best regards from an UC/UE/UES for Windows user from Austria

        2
        NewbieNewbie
        2

          Sep 27, 2009#4

          Thanks for the detailed explanation Mofi. The tip on HTML standards was interesting as well!