style for tags

Discussion in 'HTML' started by Tony Cooper, Sep 6, 2003.

  1. Tony Cooper

    Tony Cooper Guest

    In various books, and on various on-line tutorials, I see several
    different ways of writing the same thing:

    <width=250>
    <width= 250> (space between = and 250)
    <width="250">

    I've used "width" as an example, but this is just an example.

    I also see:

    <width= 250 height= 100 font size= 6>
    <width= 250 height= 100><font size= 6>

    What can be included within one set of < >, and what should be broken
    out into < > < >?
    Tony Cooper, Sep 6, 2003
    #1
    1. Advertising

  2. Tony Cooper <> wrote:
    > What can be included within one set of < >, and what should be broken
    > out into < > < >?


    Well, just to be clear, <width=60> on its own does nothing. Something like
    <div width=60> does work, however. In that case, there should be no spaces
    after or before the equals sign and the value of the attribute (width,
    height, etc.) should be quoted: <div width="60" height="50">
    --
    Michael Wilcox
    Essential Tools for the Web Developer - http://mikewilcox.t35.com
    mjwilco at yahoo dot com
    Michael Wilcox, Sep 6, 2003
    #2
    1. Advertising

  3. Tony Cooper

    Tony Cooper Guest

    On Sat, 06 Sep 2003 15:35:02 GMT, "Michael Wilcox"
    <> wrote:

    >Tony Cooper <> wrote:
    >> What can be included within one set of < >, and what should be broken
    >> out into < > < >?

    >
    >Well, just to be clear, <width=60> on its own does nothing. Something like
    ><div width=60> does work, however. In that case, there should be no spaces
    >after or before the equals sign and the value of the attribute (width,
    >height, etc.) should be quoted: <div width="60" height="50">


    The "div width" is not in my book. Cruising google, it seems that is
    a CSS tag. So far, I've been able to do what I want in simple html
    without going to CSS.

    Can CSS tags and basic html tags be mixed?

    Back to what I'm trying to figure out, though, is if there is a
    difference between:

    <width="60"><height="50">
    and
    <width="60 height="50">

    In the above, it's just more keystrokes for the first. However, I'm
    just trying to give a simple example.

    By the way, I know I can try these to see on my own screen what works
    and what doesn't. However, asking here usually gets the "why" answers
    and not just the results. That's valuable.
    Tony Cooper, Sep 6, 2003
    #3
  4. Michael Wilcox wrote:

    > Well, just to be clear, <width=60> on its own does nothing. Something like
    > <div width=60> does work, however. In that case, there should be no spaces
    > after or before the equals sign and the value of the attribute (width,
    > height, etc.) should be quoted: <div width="60" height="50">


    The value doesn't always *have* to be quoted. <div align=right> is valid
    HTML for example. It is however good practice to quote all attributes as
    it will make conversion to XHTML some point in the future more easy. It
    may also speed up parsing the document for the browser.

    --
    Toby A Inkster BSc (Hons) ARCS | mailto: | pgp:0x6A2A7D39
    aim:inka80 | icq:6622880 | yahoo:tobyink | jabber:
    http://www.goddamn.co.uk/tobyink/ | "You've got spam!"
    playing://(nothing)
    Toby A Inkster, Sep 6, 2003
    #4
  5. Tony Cooper <> wrote:
    > Can CSS tags and basic html tags be mixed?


    CSS isn't tags, it's sort of a language. HTML is the structure of the
    document made with tags: the headings, paragraphs, lists, tables, etc. CSS
    adds the look-and-feel to the structure: colors, heights, widths, etc. If
    the CSS is taken away, the structure and logical order of the document
    reamins.

    > Back to what I'm trying to figure out, though, is if there is a
    > difference between:
    >
    > <width="60"><height="50">
    > and
    > <width="60 height="50">


    What do you expect these to do? Nothing will happen if those tags are in an
    HTML document. "width" and "height" are both valid attributes only if used
    with an element. Can you be specific about what you are specifying the width
    and height of?

    > By the way, I know I can try these to see on my own screen what works
    > and what doesn't. However, asking here usually gets the "why" answers
    > and not just the results. That's valuable.


    I agree in the value of the reasons behind things, which is why I'm asking
    all these questions.
    --
    Michael Wilcox
    Essential Tools for the Web Developer - http://mikewilcox.t35.com
    mjwilco at yahoo dot com
    Michael Wilcox, Sep 6, 2003
    #5
  6. Tony Cooper <> wrote:
    > Back to what I'm trying to figure out, though, is if there is a
    > difference between:
    >
    > <width="60"><height="50">
    > and
    > <width="60 height="50">


    I'm sorry, I was working under the imprression that you were new to HTML. To
    use and example from one of your other posts: <th height= 50> should become
    <th height="50"> (no space, quoted numbers). However, before you start to
    depend on attributes like height for things in you document, learn CSS (it's
    easy) and use that for formatting instead.
    --
    Michael Wilcox
    Essential Tools for the Web Developer - http://mikewilcox.t35.com
    mjwilco at yahoo dot com
    Michael Wilcox, Sep 6, 2003
    #6
  7. Tony Cooper

    Tony Cooper Guest

    On Sat, 06 Sep 2003 16:46:39 GMT, "Michael Wilcox"
    <> wrote:

    >Tony Cooper <> wrote:
    >> Can CSS tags and basic html tags be mixed?

    >
    >CSS isn't tags, it's sort of a language. HTML is the structure of the
    >document made with tags: the headings, paragraphs, lists, tables, etc. CSS
    >adds the look-and-feel to the structure: colors, heights, widths, etc. If
    >the CSS is taken away, the structure and logical order of the document
    >reamins.


    I know enough that CSS means cascading style sheets, but the question
    here is can <div width="60"> be used if style sheets are not used?

    >> Back to what I'm trying to figure out, though, is if there is a
    >> difference between:
    >>
    >> <width="60"><height="50">
    >> and
    >> <width="60 height="50">

    >
    >What do you expect these to do? Nothing will happen if those tags are in an
    >HTML document. "width" and "height" are both valid attributes only if used
    >with an element. Can you be specific about what you are specifying the width
    >and height of?


    Sorry...I'm too close to the problem and assume others see what I see.
    These tags will be in a table and used to determine the size of the
    table data box. I never use a width in pixels, but rather use a width
    in percentage if I need to control the width. I just used the number
    as an example for the basic question.

    Generally, they will be in the table data of an image. I normally
    crop the image in Photoshop7 to the size I want it and don't bother
    controlling size by html, but there are times I might.

    I do use <th "height="x"> to set the size of the header table area.
    Sometimes I'll use it in a table text area just to give white space
    around the text. Since I try to set up one style as a template, it's
    easier than a lot of <br>s or padding.

    In another posting, I've asked about where to set the width of the
    entire table (by percent) so it can be viewed on all monitor settings.

    If you want to see an example of one of the ads I've done, see:
    http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=2555283241
    I'm always trying to improve the appearance, and working on some
    changes now.

    Thanks for your help.


    >> By the way, I know I can try these to see on my own screen what works
    >> and what doesn't. However, asking here usually gets the "why" answers
    >> and not just the results. That's valuable.

    >
    >I agree in the value of the reasons behind things, which is why I'm asking
    >all these questions.
    Tony Cooper, Sep 6, 2003
    #7
  8. Tony Cooper

    Tony Cooper Guest

    On Sat, 06 Sep 2003 16:50:48 GMT, "Michael Wilcox"
    <> wrote:

    >Tony Cooper <> wrote:
    >> Back to what I'm trying to figure out, though, is if there is a
    >> difference between:
    >>
    >> <width="60"><height="50">
    >> and
    >> <width="60 height="50">

    >
    >I'm sorry, I was working under the imprression that you were new to HTML. To
    >use and example from one of your other posts: <th height= 50> should become
    ><th height="50"> (no space, quoted numbers). However, before you start to
    >depend on attributes like height for things in you document, learn CSS (it's
    >easy) and use that for formatting instead.


    That was a pretty good assumption. I'm new in that I only started
    using html a few months ago, I've never done anything in html except
    eBay ads, and that I try to keep things as absolutely simple as
    possible. I probably average around 50 lines of html per ad, and
    that's only because I tend to put things on separate lines that could
    be on one line. That works better when setting up a template that is
    revised in part each time.

    eBay ads stay up for 7 days, and then disappear forever, In my niche,
    I'm lucky to get 75 viewers over the life of the ad.

    I've resisted learning CSS (although I bought a book on it that I've
    never cracked) because I've heard that it doesn't work right for all
    viewers. When an ad only reaches 75 people, a garbled ad for 7 of
    them can be a real problem.
    Tony Cooper, Sep 6, 2003
    #8
  9. Tony Cooper <> wrote:
    > I've resisted learning CSS (although I bought a book on it that I've
    > never cracked) because I've heard that it doesn't work right for all
    > viewers. When an ad only reaches 75 people, a garbled ad for 7 of
    > them can be a real problem.


    A "garbled" ad won't exist if you use CSS and HTML properly. Something
    like...

    <div id="advert">
    <span id="adhead">Heading Text</span><br>
    <img src="adimg.png" alt="Buy a new boat!" height="70" width="200">
    </div>

    ....would look just fine on an older/text/aural browser, and can look great
    on a visual browser by placing the following in the document's head:

    <style type="text/css">
    #advert
    {
    width: 200px;
    background-color: #66CCCC;
    font-family: arial, helvetica, san-serif;
    text-align: center;
    padding: 5px;
    }

    #adhead
    {
    font-weight: bold;
    font-size-increase: 120%;
    }
    </style>


    --
    Michael Wilcox
    Essential Tools for the Web Developer - http://mikewilcox.t35.com
    mjwilco at yahoo dot com
    Michael Wilcox, Sep 6, 2003
    #9
  10. "Michael Wilcox" <> writes:

    > [...] <th height= 50> should become
    > <th height="50"> (no space, quoted numbers).


    In terms of ad hoc implementations, yes, every voodoo spell certainly
    helps web wowsers to successfully process document instances bug by bug.

    It doesn't hurt, however, to realize that there *is* a difference
    between a *standard* -- the HTML syntax is supposed to be based upon one
    -- and an 'industry standard' -- 'industry' meaning that there ar no
    bugs to be solved, only 'good practice recommendations' to be resolved,
    and 'standard' meaning habituation is the goal rather than the
    consequence. So:

    In terms of syntax, no, neither of the arguments in parentheses is
    mandatory in this case.

    For details, see

    - attribute specification
    <http://www.w3.org/MarkUp/SGML/productions.html#prod32>

    which states where space

    <http://www.w3.org/MarkUp/SGML/productions.html#prod5>

    is suitable, and

    <http://www.w3.org/MarkUp/SGML/productions.html#prod35>

    vs.

    <http://www.w3.org/MarkUp/SGML/productions.html#prod34>

    for the verbose explanation of /attribute value/ and /attribute value
    literal/. The practical implications are probably easier understood by
    consulting

    <http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.2.2>


    --
    "Defining the tags first and then trying to reverse-engineer a DTD is
    working against SGML."
    --Joe English
    Eric B. Bednarz, Sep 7, 2003
    #10
  11. Michael Wilcox wrote:

    > A "garbled" ad won't exist if you use CSS and HTML properly. Something
    > like...
    >
    > <div id="advert">
    > <span id="adhead">Heading Text</span><br>
    > <img src="adimg.png" alt="Buy a new boat!" height="70" width="200">
    > </div>


    .... is total crap. Why claim to be demonstrating HTML and CSS properly but
    give a complete abuse of both as an example.

    First off, what is '<span id="adhead">Heading Text</span><br>' supposed to
    mean? Answer: it adds no meaning to the document at all. For headings, use
    <hX> elements -- that is why <hX> elements exist -- it is their entire
    reason for existing -- why deny them their destiny? Instead use:

    <div id="advert">
    <h1>Heading Text</h1>
    <img src="adimg.png" alt="Buy a new boat!" height="70" width="200">
    </div>

    this actually has *meaning*.

    > ...would look just fine on an older/text/aural browser, and can look
    > great on a visual browser by placing the following in the document's
    > head:


    Just a guess, but I doubt eBay would let you do that.

    > font-size-increase: 120%;


    Huh?

    --
    Toby A Inkster BSc (Hons) ARCS | mailto: | pgp:0x6A2A7D39
    aim:inka80 | icq:6622880 | yahoo:tobyink | jabber:
    http://www.goddamn.co.uk/tobyink/ | "You've got spam!"
    playing://(nothing)
    Toby A Inkster, Sep 7, 2003
    #11
  12. Tony Cooper

    Tony Cooper Guest

    On Sun, 07 Sep 2003 10:38:19 +0100, Toby A Inkster
    <> wrote:

    >Just a guess, but I doubt eBay would let you do that.


    I'm not sure what you are referring to, but in an eBay ad one can use
    HTML as the description and bypass the eBay text entry box.

    When you do an eBay ad, the concern is not what eBay will allow you to
    do, but how the reader will view the ad. In many categories, like the
    ones I run ads in, the buyers are limited and the ad is usually viewed
    by about 100 people or less. That doesn't give you much room to
    exclude anyone because they are using an 800 x 600 screen or
    something. An ad only runs for 7 days, and it can't be changed once a
    single bid is made. One can't fiddle around until it's right. One
    can't use large images that take too long to load. Anything other
    than an image of the product is distracting. If it's something that
    moves, flashes, or makes sounds, it annoys people.

    It's a specialized application. Not that it's particularly difficult
    or special, but I've seen some examples of overkill where some
    whiz-bang "webmaster" tries to use a sledge hammer to kill a fly and
    ends up with an ad that no one reads because it takes too long to load
    or buries the important information in a load of distracting crap.
    Tony Cooper, Sep 7, 2003
    #12
  13. Tony Cooper wrote:

    > On Sun, 07 Sep 2003 10:38:19 +0100, Toby A Inkster
    > <> wrote:
    >
    >> Just a guess, but I doubt eBay would let you do that.

    >
    > I'm not sure what you are referring to, but in an eBay ad one can use
    > HTML as the description and bypass the eBay text entry box.


    If you'd quoted a little more, you might have seen to what I was
    referring:

    > placing the following in the document's head


    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?id=132
    playing://the_all_seeing_i/walk_like_a_panther/02_beat_goes_on.ogg
    Toby A Inkster, Sep 7, 2003
    #13
  14. Tony Cooper

    Steve Pugh Guest

    Tony Cooper <> wrote:

    >In various books, and on various on-line tutorials, I see several
    >different ways of writing the same thing:
    >
    ><width=250>
    ><width= 250> (space between = and 250)
    ><width="250">


    Those are all rubbish. But let's assume you simply forgot to include
    the element name.

    <table width=250>, etc.

    In this case they are all correct. The space between the = and the
    value makes no difference (nor does a space between attribute name and
    the =).

    However, not all values can be left unquoted. See
    http://www.w3.org/TR/html401/intro/sgmltut.html#idx-attribute-6 for
    the rules on when attribute values must be quoted.

    In XHTML attribute values must always be quoted.

    >I also see:
    >
    ><width= 250 height= 100 font size= 6>
    ><width= 250 height= 100><font size= 6>
    >
    >What can be included within one set of < >, and what should be broken
    >out into < > < >?


    What are the HTML elements in question? font is not an attribute of
    any HTML element, so your first example makes no sense. The font
    element is also long deprecated and there is no need to use it in
    pages created in 2003 so you second example is a diversion from the
    real question.

    Mark your content up with the appropriate HTML elements, adding those
    attributes that actually exist for those elements and which are either
    mandatory or needed by your content.

    If you have a specific example where you can not decide whether to use
    an attribute or not please post it.

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
    Steve Pugh, Sep 8, 2003
    #14
  15. Tony Cooper

    Dave Saville Guest

    Font question - was - style for tags

    On Mon, 08 Sep 2003 12:20:40 +0100, Steve Pugh wrote:

    >What are the HTML elements in question? font is not an attribute of
    >any HTML element, so your first example makes no sense. The font
    >element is also long deprecated and there is no need to use it in
    >pages created in 2003 so you second example is a diversion from the
    >real question.
    >
    >Mark your content up with the appropriate HTML elements, adding those
    >attributes that actually exist for those elements and which are either
    >mandatory or needed by your content.


    OK Steve - I have a question for you then. I have a site that holds
    archives of newsletters. Each of which is a proper html doc in its own
    right. The site also has a search facility - give it a string and it
    will return a list of all newsletters that contain that string.
    Clicking on a button for a particular newsletter pumps the existing
    HTML through a script that puts a <font red> </font> either side of
    every occurrence of string. In other words the search string is
    highlighted wherever it occurs.

    Now if <font> is depreciated and "bad style" how the heck do I do this?
    My understanding is that I can't use a CSS, as that relates to a tag,
    and I don't want to use *any* tag that will change the font style of
    the doc - I just want to highlight that string - and don't want to
    falsely highlight anything else.

    So how?


    Regards

    Dave Saville

    NB switch saville for nospam in address
    Dave Saville, Sep 8, 2003
    #15
  16. Re: Font question - was - style for tags

    Dave Saville wrote:

    >I have a site that holds
    >archives of newsletters. Each of which is a proper html doc in its own
    >right. The site also has a search facility - give it a string and it
    >will return a list of all newsletters that contain that string.
    >Clicking on a button for a particular newsletter pumps the existing
    >HTML through a script that puts a <font red> </font> either side of
    >every occurrence of string. In other words the search string is
    >highlighted wherever it occurs.
    >
    >Now if <font> is depreciated and "bad style" how the heck do I do this?
    >My understanding is that I can't use a CSS, as that relates to a tag,
    >and I don't want to use *any* tag that will change the font style of
    >the doc - I just want to highlight that string - and don't want to
    >falsely highlight anything else.


    How about using <span class="searchhit"></span> around the word in
    question, and include a span.searchhit entry in the stylesheet.

    Terry
    Terry Orchard, Sep 8, 2003
    #16
  17. Tony Cooper

    Dave Saville Guest

    Re: Font question - was - style for tags

    On Mon, 08 Sep 2003 13:15:37 GMT, Terry Orchard wrote:

    >>Now if <font> is depreciated and "bad style" how the heck do I do this?
    >>My understanding is that I can't use a CSS, as that relates to a tag,
    >>and I don't want to use *any* tag that will change the font style of
    >>the doc - I just want to highlight that string - and don't want to
    >>falsely highlight anything else.

    >
    >How about using <span class="searchhit"></span> around the word in
    >question, and include a span.searchhit entry in the stylesheet.


    Thank you Terry - I did not know about <span> - Seems a very flexible
    tag. So as long as I can define a unique class then the doc using <span
    class=something else> won't be affected? Cool.

    Aren't these NGs great :)

    Regards

    Dave Saville

    NB switch saville for nospam in address
    Dave Saville, Sep 8, 2003
    #17
  18. Tony Cooper

    Tony Cooper Guest

    On Mon, 08 Sep 2003 12:20:40 +0100, Steve Pugh <> wrote:

    >Tony Cooper <> wrote:
    >
    >>In various books, and on various on-line tutorials, I see several
    >>different ways of writing the same thing:
    >>
    >><width=250>
    >><width= 250> (space between = and 250)
    >><width="250">

    >
    >Those are all rubbish. But let's assume you simply forgot to include
    >the element name.
    >
    ><table width=250>, etc.
    >
    >In this case they are all correct. The space between the = and the
    >value makes no difference (nor does a space between attribute name and
    >the =).
    >
    >However, not all values can be left unquoted. See
    >http://www.w3.org/TR/html401/intro/sgmltut.html#idx-attribute-6 for
    >the rules on when attribute values must be quoted.
    >
    >In XHTML attribute values must always be quoted.
    >
    >>I also see:
    >>
    >><width= 250 height= 100 font size= 6>
    >><width= 250 height= 100><font size= 6>
    >>
    >>What can be included within one set of < >, and what should be broken
    >>out into < > < >?

    >
    >What are the HTML elements in question? font is not an attribute of
    >any HTML element, so your first example makes no sense. The font
    >element is also long deprecated and there is no need to use it in
    >pages created in 2003 so you second example is a diversion from the
    >real question.
    >
    >Mark your content up with the appropriate HTML elements, adding those
    >attributes that actually exist for those elements and which are either
    >mandatory or needed by your content.
    >
    >If you have a specific example where you can not decide whether to use
    >an attribute or not please post it.


    Thanks for your reply. My examples were poorly chosen, but I was
    trying for examples where the part of the line that was not in
    question would not distract. So, I deliberately left out the img
    src attribute. I just wasn't thinking when I put the font size in
    that same line. These are not real lines that I'd use. Just trying
    for an example.


    Let me try again...if the sets to be included are

    font face="arial, helvetica"
    font size ="6"
    bold
    bgcolor="#cccccc"

    and so on, what would the best way to handle it. Each could be within
    < >, or several could be within the < >. Which is better, and why?

    There is no particular combination that I'm asking about. I'm just
    looking for a general rule for what should be in one set of < >. If
    you reply to this, try to stay away from the example (which may be a
    bad one) and reply to the concept which is "what can be included in
    one set of < >?" (when it pertains to the same general thing)

    As to the font element being deprecated, I've been using "font size=
    x". It works, I've never seen a real reason not to use it. I don't
    need or use CSS since I'm really not doing a web page, but just a
    small ad with a short life.

    I'm a little surprised at the intensity of comment over this. If
    something works, and it doesn't interface with anything else, why is
    it a problem? I'm not trying to argue about it, but really curious
    about why it's a concern.

    To run on a bit, I started with HTML a couple of months ago, and - yes
    - I learned what I have learned from a book and from some on-line
    tutorials.

    The problem with learning this way is that each step is presented
    separately. The book says if you want the font to be bold, you write
    <b> on one side and </b> on another. Later, the book says if you want
    the font to be italic, you write <i> on one side and </i> on the
    other. The book never says it's best, or not right, to write <b i> if
    you want both. The book doesn't tie one thing into the next thing.
    Trial and error says that doesn't work, but each combination then
    becomes trial and error. So, the question here is to try to determine
    some rule of thumb that saves the trial and error process from each
    combination.

    The second problem with learning from a book is that the average book
    is $30 to $50, and out of date quicker than a woman's hem line. When
    you are not employed in the field, and just doing small projects, you
    end up using whatever is in that book (ie: font size="x") as long as
    it works. Ask a question based on that level, and people come down
    on you.
    Tony Cooper, Sep 8, 2003
    #18
  19. Tony Cooper

    Steve Pugh Guest

    Tony Cooper <> wrote:

    >Let me try again...if the sets to be included are
    >
    >font face="arial, helvetica"
    >font size ="6"
    >bold
    >bgcolor="#cccccc"


    The first two should be combined as a single font element, assuming
    you want _all_ the contained text to be in Arial and
    extra-extra-large.

    Bold is <b>. No attributes involved at all.

    bgcolor is only a valid attribute on <body>, <table>, <tr>, <td> and
    <th> and so van not be combined with the others anyway.

    >and so on, what would the best way to handle it. Each could be within
    >< >, or several could be within the < >. Which is better, and why?


    Only the first two you list can be combined.

    >There is no particular combination that I'm asking about. I'm just
    >looking for a general rule for what should be in one set of < >.


    Each <...> is either-
    the start tag of an element (with none or some attributes) or
    the end tag of an element.

    Looking at start tags. The text immediately after the < is the name of
    the element. Any text following that is an attribute.

    <img src="foo" alt="bar"> is an img element with src and alt
    attributes. You can not write this as <src="foo" img alt="bar">.

    > If
    >you reply to this, try to stay away from the example (which may be a
    >bad one) and reply to the concept which is "what can be included in
    >one set of < >?" (when it pertains to the same general thing)


    What do you mean the same thing?

    >As to the font element being deprecated, I've been using "font size=
    >x". It works, I've never seen a real reason not to use it. I don't
    >need or use CSS since I'm really not doing a web page, but just a
    >small ad with a short life.


    Are you saying that you will never, ever make a full web page?

    If you ever want to make a proper web page you will want to know how
    to do so to the best of your ability, won't you? So why not learn how
    to do things better now before you pick up too many bad habits? For a
    lot of the people on this newsgroup there was a period when they had
    to unlearn a lot of things. But you have the advantage that you're
    leaning now, not back in the 90s, and can learn the better way of
    doing things straight off.

    CSS is easier to update, takes less bandwidth and is more flexible.

    >I'm a little surprised at the intensity of comment over this. If
    >something works, and it doesn't interface with anything else, why is
    >it a problem? I'm not trying to argue about it, but really curious
    >about why it's a concern.


    It's about separation of content from presentation. HTML is for
    marking up content (it says what something _is_, i.e. it's mostly
    about nouns). CSS is for giving a presentation to that content (it
    says what something looks or sounds like, i.e. it's mostly about
    adjectives).

    >The problem with learning this way is that each step is presented
    >separately. The book says if you want the font to be bold, you write
    ><b> on one side and </b> on another. Later, the book says if you want
    >the font to be italic, you write <i> on one side and </i> on the
    >other. The book never says it's best, or not right, to write <b i> if
    >you want both.


    <b i> does not exist.
    There is no i attribute of the bold element.
    No book can mention all the things that don't exist.

    You seem to be suffering some confusion about what an element is and
    what and attribute is.

    HTML is composed of elements. These are marked up with start and end
    tags thus:
    <element>...</element>

    <b></b> and <i></i> are both elements.

    Most elements have a number of attributes that are added to the start
    tag of the element. These take the form of attribute="value"

    The full element is start tag (plus attributes), content, end tag.
    Always think of your HTML in terms of elements.

    >The book doesn't tie one thing into the next thing.
    >Trial and error says that doesn't work, but each combination then
    >becomes trial and error. So, the question here is to try to determine
    >some rule of thumb that saves the trial and error process from each
    >combination.


    http://www.w3.org/TR/html401/

    A full list of elements -
    http://www.w3.org/TR/html401/index/elements.html

    A full list of attributes and which elements they can be used on -
    http://www.w3.org/TR/html401/index/attributes.html

    A validator to check that your code is valid -
    http://validator.w3.org/

    Steve


    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
    Steve Pugh, Sep 8, 2003
    #19
  20. Tony Cooper

    Steve Pugh Guest

    Re: Font question - was - style for tags

    "Dave Saville" <> wrote:
    >On Mon, 08 Sep 2003 12:20:40 +0100, Steve Pugh wrote:
    >
    >>What are the HTML elements in question? font is not an attribute of
    >>any HTML element, so your first example makes no sense. The font
    >>element is also long deprecated and there is no need to use it in
    >>pages created in 2003 so you second example is a diversion from the
    >>real question.
    >>
    >>Mark your content up with the appropriate HTML elements, adding those
    >>attributes that actually exist for those elements and which are either
    >>mandatory or needed by your content.

    >
    >OK Steve - I have a question for you then. I have a site that holds
    >archives of newsletters. Each of which is a proper html doc in its own
    >right. The site also has a search facility - give it a string and it
    >will return a list of all newsletters that contain that string.
    >Clicking on a button for a particular newsletter pumps the existing
    >HTML through a script that puts a <font red> </font> either side of
    >every occurrence of string. In other words the search string is
    >highlighted wherever it occurs.


    You want to highlight the text. Sounds like a form of emphasis to me.
    So use <em class="searchterm">...</em> with the appropirate style.
    e.g.
    em.searchterm {
    font-style: inherit;
    color: #ff0000;
    background-color: #ffffff;
    }

    >Now if <font> is depreciated


    It's not depreciated. It's deprecated. They mean very different
    things.

    >and "bad style" how the heck do I do this?
    >My understanding is that I can't use a CSS, as that relates to a tag,
    >and I don't want to use *any* tag that will change the font style of
    >the doc - I just want to highlight that string - and don't want to
    >falsely highlight anything else.


    Check any good CSS tutorial to learn about classes.

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
    Steve Pugh, Sep 8, 2003
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dean H. Saxe
    Replies:
    0
    Views:
    1,023
    Dean H. Saxe
    Jan 3, 2004
  2. Rob Nicholson
    Replies:
    3
    Views:
    716
    Rob Nicholson
    May 28, 2005
  3. Ranganath

    Custom Tags within Custom Tags.

    Ranganath, Oct 17, 2003, in forum: Java
    Replies:
    2
    Views:
    453
    Ranganath
    Oct 21, 2003
  4. Mike
    Replies:
    3
    Views:
    870
    Michael Borgwardt
    Jan 9, 2004
  5. Ken Varn
    Replies:
    0
    Views:
    439
    Ken Varn
    Apr 26, 2004
Loading...

Share This Page