CSS and plain text

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Bulatovich

    CSS and plain text

    Is there a way to use CSS to format "plain" text in an html document. By
    plain I mean text which is not contained by <por <h#tags.

    Is there no way to control how this stuff is rendered?

    tia


  • Beauregard T. Shagnasty

    #2
    Re: CSS and plain text

    Michael Bulatovich wrote:
    Is there a way to use CSS to format "plain" text in an html document. By
    plain I mean text which is not contained by <por <h#tags.
    If you are using a Strict DOCTYPE, there should be no text outside of ..
    some .. element. Transitional will let you get away with it, but it is
    poor practice to do so. You lose semantic meaning if you do that.
    Is there no way to control how this stuff is rendered?
    If you describe the circumstance, some advice could be given. Such as
    "put it in a <div..." Got a sample page?

    --
    -bts
    -Motorcycles defy gravity; cars just suck.

    Comment

    • Andy Dingley

      #3
      Re: CSS and plain text


      Michael Bulatovich wrote:
      Is there a way to use CSS to format "plain" text in an html document.
      CSS can format it, but it'll all be formatted the same. The scope of
      CSS is selected (by and large) at the boundaries of these elements.
      Is there no way to control how this stuff is rendered?
      Look into using the <spanelement, or read any tutorial on CSS

      Comment

      • Brendan Gillatt

        #4
        Re: CSS and plain text

        Michael Bulatovich wrote:
        Is there a way to use CSS to format "plain" text in an html document. By
        plain I mean text which is not contained by <por <h#tags.
        >
        Is there no way to control how this stuff is rendered?
        I mostly use the body element to change page wide things for text as all
        your text should definitely be in there!

        Comment

        • Jukka K. Korpela

          #5
          Re: CSS and plain text

          Beauregard T. Shagnasty <a.nony.mous@ex ample.invalidsc ripsit:
          If you are using a Strict DOCTYPE, there should be no text outside of
          .. some .. element.
          Even if you use a Transitional DOCTYPE, there is no content text outside of
          some element, since everything is at least inside the <bodyelement. (Some
          early CSS implementations failed to apply style sheet rules to that element
          when the _tag_ <bodywas missing, but this was definitely an error - the
          element is there even if the tags aren't - and shouldn't be a problem these
          days, and never was if you use explicit <bodyand </bodytags.)

          --
          Jukka K. Korpela ("Yucca")


          Comment

          • David Dorward

            #6
            Re: CSS and plain text

            Michael Bulatovich wrote:
            Is there a way to use CSS to format "plain" text in an html document. By
            plain I mean text which is not contained by <por <h#tags.
            In an HTML document all text has to be contained by /some/ element. Apply
            the style to that element.


            --
            David Dorward <http://blog.dorward.me .uk/ <http://dorward.me.uk/>
            Home is where the ~/.bashrc is

            Comment

            • Beauregard T. Shagnasty

              #7
              Re: CSS and plain text

              Jukka K. Korpela wrote:
              Beauregard T. Shagnasty <a.nony.mous@ex ample.invalidsc ripsit:
              >
              >If you are using a Strict DOCTYPE, there should be no text outside of
              >.. some .. element.
              >
              Even if you use a Transitional DOCTYPE, there is no content text
              outside of some element, since everything is at least inside the
              <bodyelement.
              Of course. But you knew that, and so do I.

              --
              -bts
              -Motorcycles defy gravity; cars just suck.

              Comment

              • Patrick Sullivan

                #8
                Re: CSS and plain text

                Andy is right, look at <span>, it's the inline method to contain styling.

                --

                Patrick Sullivan, AA-BA, BA-IT

                "Michael Bulatovich" <Please@dont.tr ywrote in message
                news:edshm80kno @news2.newsguy. com...
                Is there a way to use CSS to format "plain" text in an html document. By
                plain I mean text which is not contained by <por <h#tags.
                >
                Is there no way to control how this stuff is rendered?
                >
                tia
                >
                >

                Comment

                • Jukka K. Korpela

                  #9
                  Re: CSS and plain text

                  Spartanicus <invalid@invali d.invalidscrips it:
                  >If you describe the circumstance, some advice could be given. Such as
                  >"put it in a <div..."
                  >
                  But "some .. element" should be "some semantic element", that excludes
                  <div>.
                  Should it? Even under the circumstances that HTML has a rather limited
                  repertoire of semantic elements? Quite often, the choice is between a
                  non-semantic element (<divor <span>) and a semantically _wrong_ element,
                  such as abusing <pfor something that ain't no paragraph.

                  From the CSS viewpoint, using semantically wrong elements has the practical
                  drawback that they may come with default property values that have been
                  designed with the correct semantics in mind. If you use <pfor
                  representing, say, a short copyright notice (<p>&copy; 2006 John Doe</p>),
                  you have to worry about the default top and bottom margin, or perhaps
                  default padding. Using <div>, you can pretty safely expect no default
                  rendering specialties: the <divelement is rendered as a block, normally
                  with no margins or padding. (The HTML specifications even say this
                  relatively clearly, though not explicitly in CSS terms.) So you can just
                  start _adding_ the styling you wish.

                  --
                  Jukka K. Korpela ("Yucca")


                  Comment

                  • Spartanicus

                    #10
                    Re: CSS and plain text

                    "Jukka K. Korpela" <jkorpela@cs.tu t.fiwrote:
                    >>If you describe the circumstance, some advice could be given. Such as
                    >>"put it in a <div..."
                    >>
                    >But "some .. element" should be "some semantic element", that excludes
                    ><div>.
                    >
                    >Should it?
                    Always, if the content as per the OP is text (or an element who's non
                    replaced content is text).
                    >Even under the circumstances that HTML has a rather limited
                    >repertoire of semantic elements? Quite often, the choice is between a
                    >non-semantic element (<divor <span>) and a semantically _wrong_ element,
                    >such as abusing <pfor something that ain't no paragraph.
                    >
                    >From the CSS viewpoint, using semantically wrong elements has the practical
                    >drawback that they may come with default property values that have been
                    >designed with the correct semantics in mind. If you use <pfor
                    >representing , say, a short copyright notice (<p>&copy; 2006 John Doe</p>),
                    >you have to worry about the default top and bottom margin, or perhaps
                    >default padding. Using <div>, you can pretty safely expect no default
                    >rendering specialties: the <divelement is rendered as a block, normally
                    >with no margins or padding. (The HTML specifications even say this
                    >relatively clearly, though not explicitly in CSS terms.) So you can just
                    >start _adding_ the styling you wish.
                    For a copyright notice, rendering with a top margin is appropriate for
                    non CSS rendering situations. Renderings other than a visual rendering
                    should be considered. A paragraph should render with a leading and
                    trailing pause in the audio domain, this is required here.

                    If no other suitable markup like <li>, <hxetc. should be used, I've
                    not yet encountered "loose" text content for which paragraph markup
                    wasn't appropriate. The dictionary definition of "paragraph" should IMO
                    not be applied strictly. The semantic distinction between a "real"
                    paragraph and short text like a copyright notice is IMO not relevant
                    from any angle. The next function of markup is IMO functionality, for
                    this paragraph markup is appropriate for all cases of "loose" text that
                    I've encountered.

                    --
                    Spartanicus

                    Comment

                    • Jukka K. Korpela

                      #11
                      Re: CSS and plain text

                      Spartanicus <invalid@invali d.invalidscrips it:
                      For a copyright notice, rendering with a top margin is appropriate for
                      non CSS rendering situations.
                      If you have, say, a collection of miscellaneous notes at the bottom of a
                      page - the typical context of a copyright notice -, such rendering would
                      look rather foolish.
                      Renderings other than a visual rendering
                      should be considered. A paragraph should render with a leading and
                      trailing pause in the audio domain, this is required here.
                      No it isn't. Who wants such pauses between various fairly irrelevant final
                      notes?
                      If no other suitable markup like <li>, <hxetc. should be used, I've
                      not yet encountered "loose" text content for which paragraph markup
                      wasn't appropriate.
                      That's just because you _don't_ use paragraph markup semantically.
                      The dictionary definition of "paragraph" should
                      IMO not be applied strictly.
                      That's the common poor excuse that people present when they use markup (or
                      terms or whatever) so loosely that they have no real meaning any more. What
                      you are saying is that you do not care about what "paragraph" means in
                      normal English, which is what the semantic definition of <pin HTML
                      specifications refers to. You just try to obscure this by throwing in
                      dictionaries and "strictness ". That's like saying that we do not apply
                      strictly the dictionary definition of "black" but use the word liberally and
                      progressively (so that it includes white if convenient).
                      The semantic distinction between a "real"
                      paragraph and short text like a copyright notice is IMO not relevant
                      from any angle.
                      Now that's a yet another attempt at confusing things, and if you really
                      believed in what you previously wrote (effectively saying that a short
                      copyright notice _is_ a paragraph), you would not have resorted to that lame
                      excuse. You are now saying that a semantic distinction is "not relevant from
                      any angle", so why do you say that we should use semantic markup for
                      everything?

                      You have just turned <pinto <divin disguise - into a general block
                      element. You just lost the semantics included into the use of <pas per the
                      specifications. If you want the _best_ excuse for that, it's this: "p" is
                      two characters shorter than "div".

                      --
                      Jukka K. Korpela ("Yucca")


                      Comment

                      • Beauregard T. Shagnasty

                        #12
                        Re: CSS and plain text

                        Spartanicus wrote:
                        "Beauregard T. Shagnasty" <a.nony.mous@ex ample.invalidwr ote:
                        >
                        >>Is there a way to use CSS to format "plain" text in an html
                        >>document. By plain I mean text which is not contained by <por
                        >><h#tags.
                        >>
                        >If you are using a Strict DOCTYPE, there should be no text outside
                        >of .. some .. element. Transitional will let you get away with it,
                        >but it is poor practice to do so. You lose semantic meaning if you
                        >do that.
                        >
                        Indeed.
                        >
                        >If you describe the circumstance, some advice could be given. Such as
                        >"put it in a <div..."
                        >
                        But "some .. element" should be "some semantic element", that
                        excludes <div>.
                        You and Jukka have covered all the bases. I said what I said (note that
                        I did mention semantics), because we at this point don't know what the
                        OP's "plain text" really is. It may itself have no semantic meaning, and
                        may just be some sort of "decoration ."

                        --
                        -bts
                        -Motorcycles defy gravity; cars just suck.

                        Comment

                        • Spartanicus

                          #13
                          Re: CSS and plain text

                          "Jukka K. Korpela" <jkorpela@cs.tu t.fiwrote:
                          >For a copyright notice, rendering with a top margin is appropriate for
                          >non CSS rendering situations.
                          >
                          >If you have, say, a collection of miscellaneous notes at the bottom of a
                          >page - the typical context of a copyright notice -, such rendering would
                          >look rather foolish.
                          I'm having difficulty imagining what content and structure you are
                          alluding to, please provide an example.

                          I consider the following to be best practice markup, with an appropriate
                          example styling:


                          If not itself marked up as a paragraph, the copyright text could render
                          flush to the preceding paragraph (depending on the styling defaults of a
                          visual client), with the possibility that the line break may be obscured
                          resulting in no way to distinguish it from the preceding paragraph,
                          demo: http://homepage.ntlworld.ie/spartani..._copyright.png

                          Using paragraph markup for the copyright text should ensure that it will
                          always be rendered distinct from preceding semantically marked up
                          content (excluding daft browser defaults or things like daft user CSS).

                          Btw, the screenshot is from a reputable client with unmodified default
                          rendering.
                          >If no other suitable markup like <li>, <hxetc. should be used, I've
                          >not yet encountered "loose" text content for which paragraph markup
                          >wasn't appropriate.
                          >
                          >That's just because you _don't_ use paragraph markup semantically.
                          Correct, I use markup functionally since there is no benefit in making a
                          semantic distinction between short text and a paragraph, even if we had
                          a semantic element for structural short text.

                          Ideally markup should accurately reflect the content, but since we have
                          quite limited options within the confines of HTML4, and because there is
                          no benefit from distinguishing between structural short text and a
                          paragraph I look at what purposes markup should provide other than to
                          reflect the semantics. Paragraph markup provides structure, and unlike
                          the semantic distinction between a paragraph and short text, this
                          structure provides for an actual need.

                          The idea that paragraph markup should not be used for short texts
                          assumes that a clear distinction can be made between the two, this is
                          obviously not the case, and therefore alone not a viable position.

                          --
                          Spartanicus

                          Comment

                          • Michael Bulatovich

                            #14
                            Re: CSS and plain text

                            Thanks Mr. Shagnasty, Jukka, and others. I think you've covered it.

                            The text to which I referred could be within <bodytags, but not otherwise
                            contained by what I would recognize as typical selectors for text (h#, p,
                            blockquote, etc.) If I understand correctly, it sounds like this sort of
                            thing could be influenced by using the body as selector.


                            "Beauregard T. Shagnasty" <a.nony.mous@ex ample.invalidwr ote in message
                            news:RYyMg.8847 5$5i3.77397@bgt nsc04-news.ops.worldn et.att.net...
                            Spartanicus wrote:
                            >
                            >"Beauregard T. Shagnasty" <a.nony.mous@ex ample.invalidwr ote:
                            >>
                            >>>Is there a way to use CSS to format "plain" text in an html
                            >>>document. By plain I mean text which is not contained by <por
                            >>><h#tags.
                            >>>
                            >>If you are using a Strict DOCTYPE, there should be no text outside
                            >>of .. some .. element. Transitional will let you get away with it,
                            >>but it is poor practice to do so. You lose semantic meaning if you
                            >>do that.
                            >>
                            >Indeed.
                            >>
                            >>If you describe the circumstance, some advice could be given. Such as
                            >>"put it in a <div..."
                            >>
                            >But "some .. element" should be "some semantic element", that
                            >excludes <div>.
                            >
                            You and Jukka have covered all the bases. I said what I said (note that
                            I did mention semantics), because we at this point don't know what the
                            OP's "plain text" really is. It may itself have no semantic meaning, and
                            may just be some sort of "decoration ."
                            >
                            --
                            -bts
                            -Motorcycles defy gravity; cars just suck.

                            Comment

                            • Jón Fairbairn

                              #15
                              Re: CSS and plain text

                              "Michael Bulatovich" <Please@dont.tr ywrites:
                              Thanks Mr. Shagnasty, Jukka, and others. I think you've covered it.
                              >
                              The text to which I referred could be within <bodytags, but not otherwise
                              contained by what I would recognize as typical selectors for text (h#, p,
                              blockquote, etc.) If I understand correctly, it sounds like this sort of
                              thing could be influenced by using the body as selector.
                              But what /is/ it? I'm finding it hard to come to terms with
                              the idea of text that belongs to no semantic category.

                              --
                              Jón Fairbairn Jon.Fairbairn@c l.cam.ac.uk

                              Comment

                              Working...