1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Good code, bad code, it's all about developing good behaviors.

Discussion in 'HTML & Website Design' started by deathshadow, Sep 21, 2008.

  1. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #21
    Sorry for being an idiot but I never understand when i see things on templates and other peoples pages such as:

    <p><img src="" alt="" /></p>

    <p><input etc.. /> </p>

    Why wrap these things in paragraphs?
     
    wd_2k6, Oct 24, 2008 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #22
    Because a paragraph is a typographical structure. It is a composition[1], complete in one typographic section. The paragraph, which so many confuse with sentences, etc., is not a part of grammar. It is simply a structure used in printing or writing. Thus any bit of text, images, or as you mentioned, form controls should be in a paragraph structure. In html, there are other typographic structures that may fit more specifically, such as fieldsets, lists, headers, addresses, etc.. The div, which many espouse using in place of the paragraph is less specific, having no defined semantic or structural value other than as an aggregating container.

    cheers,

    gary

    [1] composition is taken in the typographic sense of setting up type and arranging it for printing.
     
    kk5st, Oct 24, 2008 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #23
    An environment (print) in which what you are saying has NOTHING to do with what a paragraph means - hence the reason dictionary.com doesn't say it that way, no dictionary I'm aware of says it that way, print layout programs like quark and pagemaker don't say it that way, and neither does any print/typographical environment I've ever dealt with. In fact, a paragraph is a GRAMMATICAL construct, NOT a typographical one.

    This notion seems to be some sort of nonsensical new rubbish promoted by people who don't know what the word means. File use of paragraph in this manner with "Oh the humanity", "mute point", and a military unit going "Rouge" (ok, just waiting for people who don't get the joke)
     
    deathshadow, Oct 24, 2008 IP
  4. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #24
    Thanks for the replies.

    I thought the whole idea was to obtain as minimal markup as possible, therefore adding the <p> around these seem irrelevant when the images can be styled?

    I understand it being used around the images if they require a special stye I guess but using it as a blank wrapper seems as it has no value to anyone.

    I personally believe paragraphs should be strictly used for blocks of text, within the main body of the document.
     
    wd_2k6, Oct 24, 2008 IP
  5. rochow

    rochow Notable Member

    Messages:
    3,991
    Likes Received:
    245
    Best Answers:
    0
    Trophy Points:
    240
    #25
    id="my-special-style". Don't need to wrap it anything (especially a p)

    http://dictionary.reference.com/browse/paragraph

    It mentions "several sentences" a few times.

    Here's something people seem to be opinionated on. Does everything require a tag? Such as:

    <div id="footer">
    Copyright 2008 Website

    <a href="#">Site by Whoever</a>
    </div>

    Say the link is positioned right. Now you could wrap copyright in a <p>, but it's not correct. You could use <em> but I'll argue til the day I die it has no emphasise (especially when its then removed in the stylesheet to look the same as normal text). And let's say they both have to be in that div, so it either has to be left as plain text, or wrapped in something.
     
    rochow, Oct 24, 2008 IP
  6. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #26
    The paragraph is strictly a typographic or manuscript construct. Its origins lie in making a margin mark or stroke to call attention to something in the text, e.g., a change of subject. The word paragraph come from the Greek, παρα γραφοσ or para grafos, to write beside. Sometime in the middle ages, the side mark was moved to immediately before the change, within the text. The mark might any notable symbol and was often a different colored ink. The 'standard' mark was and is the pilcrow, "¶", which is simply a reversed "P".

    Are you with me so far? See anything about grammar yet? I didn't think so.

    The next advance really came with movable type. Typesetters began starting paragraphs on a new line. The pilcrow remained, but typesetters began removing it and leaving a blank space. Thus the indent as a delimiter.

    Now, you said, "… no dictionary I'm aware of says it that way, print layout programs like quark and pagemaker don't say it that way, and neither does any print/typographical environment I've ever dealt with. In fact, a paragraph is a GRAMMATICAL construct, NOT a typographical one."

    I'm surprised you've never heard of Webster's. It's pretty common. The definition of a paragraph that I've quoted numerous times comes from it. Then, there's the definition of composition, "1. The act or art of composing, or forming a whole or integral, by placing together and uniting different things, parts, or ingredients. In specific uses:
    …
    (d) (Print.) The setting up of type and arranging it for printing."

    That's also from Webster.

    "I've never heard of it" is a pretty much non-credible argument. That you want to believe a paragraph is a grammatic and not a typographical construct does not make it so. No matter how loudly you shout that a paragraph is grammar and not typography does not make it so. Nor, will wishing make it so.

    This is another example of something you know so surely that just isn't so. Feel free to mark up your content in any way you see fit, but expect to be shown the error of your ways if you cannot prove your position when making specific or implied challenges to statements I've made.

    gary
     
    kk5st, Oct 24, 2008 IP
  7. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #27
    Uhm... Mirriam Websters defines it thus:

    1 a: a subdivision of a written composition that consists of one or more sentences, deals with one point or gives the words of one speaker, and begins on a new usually indented line b: a short composition or note that is complete in one paragraph

    2: a character (as ¶) used to indicate the beginning of a paragraph and as a reference mark

    It also has the entymology.

    Etymology:
    Middle English paragraf marginal sign marking a paragraph, from Anglo-French parogref, from Medieval Latin paragraphus, from Greek paragraphos line used to mark change of persons in a dialogue, from paragraphein to write alongside, from para- + graphein to write

    Websters New World defines it thus:

    1: a distinct section or subdivision of a chapter, letter, etc., usually dealing with a particular point: it is begun on a new line, often indented

    2: a mark (¶) used as by proofreaders to indicate the beginning of a paragraph or as a sign marking material referred to elsewhere

    3: a brief article, item, or note in a newspaper or magazine

    Don't know exactly where you're getting this (d) thing - but it sure ain't websters.

    In fact, try this:
    http://www.onelook.com/?w=paragraph&ls=a

    You wont find it in ANY of those either. It's not in my print Mirriam-Websters (unabridged) that way, it's not in my copy of American Heritage, nor is it in my copy of the Oxford dictionary the way you are saying.

    Excuse my skepticism - I've seen people make this arguement before and I have YET to see an online or print dictionary agree with it. This is the point where Iceman sneazes about the close encounter with a T-38 masquerading as a Mig-29. I know, why don't you look that up in your Funk and Wagnalls. ;)

    That you want it in a dictionary the way you understand it doesn't mean it's there, or that a STRUCTURAL element in discourse usually taught in the 2nd grade as part of grammar is miraculously a typographical element to be slapped around everything willy-nilly.

    -- edit --
    My bad, you were pulling the definition of composition, which is odd since it has exactly WHAT to do with paragraph abuse exactly? I've worked in print, I still work in print, and whoever filled your head with that nonsense needs a brick upside the head.

    That said on the latter half of the second new world definition would come CLOSE to wrapping a 'back to main' link - and that's one HELL of a stretch. It sure as shine wouldn't cover a footer or an image.
     
    deathshadow, Oct 25, 2008 IP
  8. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #28
    Ah, a structural element, nothing to do with grammar.

    Hmm, that's a typographical thingie, right?

    You left out that it was used to distinguish a change in subject and a point of interest, too. All typographical, not grammatical.

    A distinct section … like to separate typographically, maybe?

    Purely typographic.

    Typographically distinct. Well, nothing about grammar there.

    Maybe if it were together with the paragraph definition, you could catch on.

    "A brief composition [setting up of type and arranging it for printing] complete in one typographical section"

    He's probably dead, now. In 1974 or 5, I did some portraits to be used as guides for woodcuts that would end up in an ultra high quality book of poetry. (The book was high quality, I can't say as much for the poetry.) The printer was an old line letterpress man. He seemed to consider each section of type, even the space reserved for the litho, to be a paragraph regardless of its content.

    It has become obvious you have nothing to back your opinion.

    gary
     
    kk5st, Oct 25, 2008 IP
  9. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #29
    I kept expecting someone to call me on that. Anyone. :) I did work with some very skilled pressman back in my days as a working photographer, but I made that up. :shrug: All the printers I knew, and as far as that goes, the DTP people and the graphic artists that I've worked with were and are very parochial, not caring much about the history or traditions of their crafts. Nor is there any great interest in complementary crafts.

    It was my obviously poor attempt to sarcastically make the point that it doesn't matter whether anyone knows what a paragraph is. Whether anyone knows or not does not change the fact that it is a typographical construction for the purpose of lending separation to a change of subject, a change of speaker, implied or explicit, or any other bit that needs a typographical identity.

    cheers,

    gary
     
    kk5st, Oct 25, 2008 IP
  10. rochow

    rochow Notable Member

    Messages:
    3,991
    Likes Received:
    245
    Best Answers:
    0
    Trophy Points:
    240
    #30
    Haha, well not everyone went to school back when English actually mattered. Nowadays, half the assignments handed in barely make sense and still get a pass. So you can't really blame most people for not knowing the finer technicality things, like what a paragraph technically is. As far as we were taught, every time you presented a new point, you made a new paragraph.
     
    rochow, Oct 25, 2008 IP
  11. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #31
    The p around the img thing seems to rely on a Chinese proverb : ) I only wrap my img's in p's when the two need to be a unit for some reason.

    In old HTML, the <p> was just a spacing tag so that people could space their paragraphs. It wasn't really a wrapping tag (or at least nobody used it that way, prolly due to the rules saying you didn't have to close many tags). It used to be used like br is today:

    <td>Blah blah blah blah blah Blah blah blah blah blah Blah blah blah blah blah Blah blah blah blah blah Blah blah blah blah blah Blah blah blah blah blah
    <p>
    Blah blah blah blah blah Blah blah blah blah blah Blah blah blah blah blah Blah blah blah blah blah Blah blah blah blah blah Blah blah blah blah blah Blah blah blah blah blah Blah blah blah blah blah</td>
     
    Stomme poes, Oct 27, 2008 IP
  12. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #32
    The closing p is optional in html, but the UA closes <p> when it reaches another element that may not live within p. The following
    
    <td>
      <p> blah blah blah
      <img src="" alt="">
    </td>
    Code (markup):
    is treated internally (the DOM) as
    
    <td>
      <p>blah blah blah <img src="" alt=""></p>
    </td>
    Code (markup):
    Elements that have optional opening or closing tags still have those tags implicitly. The following is 100% valid.
    <style type="text/css">
    p {
      background-color: black;
      color: white;
      }
    </style>
    <p>blah blah blah
    <img src="some.png" alt="a sample image">
    Code (markup):
    The html, head, and body tags are implied. In FF, open the DOM inspector to see just how the UA views the document. DOM view attached.

    cheers,

    gary
     
    kk5st, Oct 27, 2008 IP
  13. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #33
    Ack! My attachment got lost. I'll try again.
     

    Attached Files:

    kk5st, Oct 27, 2008 IP
  14. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #34
    Because grammar of course has nothing to do with structure... Structure inside sentences, structure for grouping sentences. Completely unrelated, right?

    Which as I said is the only way you could consider it relevant, but that's a real stretch as you are then using it not for the literary construct of grouping sentences (def 1), which being it's supposed to be a block that WRAPS tags is the only reason for it. If it were indeed a stand alone tag NOT wrapping elements, THEN it would make sense as it would be a single mark, not a block.

    Grammar goes beyond how you put a sentence together, are you saying that it's gramatically correct to just keep stringing unrelated sentences together in one endless stream? Speaking of streams, I was out fishing the other day and saw a bear. Bears are cool, but not as cool as the moon. We like the moon, 'cause it is close to us. We like the moon, but not as much as a spoon. 'Cause spoons are good for eating soup. signal before changing lanes ;)

    or a grammatical construct to separate topics?

    Let's try this...

    typography from American Heritage:

    1. the art or process of printing with type.

    2. the work of setting and arranging types and of printing from them.

    3. the general character or appearance of printed matter

    grammar from American Heritage

    1. the study of the way the sentences of a language are constructed; morphology and syntax.

    2. these features or constructions themselves: English grammar.

    3. an account of these features; a set of rules accounting for these constructions: a grammar of English.

    4. Generative Grammar. a device, as a body of rules, whose output is all of the sentences that are permissible in a given language, while excluding all those that are not permissible.

    5. prescriptive grammar.

    6. knowledge or usage of the preferred or prescribed forms in speaking or writing: She said his grammar was terrible.

    7. the elements of any science, art, or subject.

    8. a book treating such elements.

    One has to figure that the structure of sentences by extension must include how you group them together.

    Really? Nothing there says typography either- and notice it says nothing about controls, standouts, plates or a half dozen other things. Omission does not automatically mean inclusion.

    Boy, I know some editors and engish teachers that would have a field day with that.

    No, just you seem to be stuffing your own meanings in on words because of what the definitions DON'T say. Basically comes down to arguing semantics which ends up the same as "A priest, a rabbi and a ayatollah enter a bar"

    Though I think the biggest arguement to shoot down the typography thing is that paragraphs pre-date it - and are used when you are NOT doing layout for print. You sit down to write a paper by hand, is that typography when you skip a line and indent? Only definition #3 for typography could apply, and again that's one HELL of a stretch since 'print' in this term basically means moveable type, not handwriting.
     
    deathshadow, Oct 28, 2008 IP
  15. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #35
    Which is another of those details in the specification most people never even see - especially in the days before anyone gave the HTML specifications anything more than lip service (so... before five to six years ago?)

    What confuses most people is that every word processor that shows it's paragraph marks, puts them IN THE WRONG PLACE - at the end of the paragraph. By the definition they are supposed to go at the beginning of it if you are using them under the "A mark ( ¶ ) used to indicate where a new paragraph should begin or to serve as a reference mark." definition. Because word processors show them at the end, people moving to HTML after learning to use a word processor assumes that's where they go.

    The HTML 2 spec still shows the best examples of how it's supposed to be used in HTML:
    http://www.w3.org/MarkUp/html-spec/html-spec_5.html#SEC5.5.1

    Though I like this part:
    So you mean... the typography? Again why I view it as a grammatical structural unit (since we are assuming it wraps sentences) and not as a typographical one.

    After all, that's what semantic markup is SUPPOSED to be about. Saying what it is you are marking up into blocks - and NOT implying meanings that are inappropriate... like paragraph abuse, definition list abuse, improper heading tag orders, and the whole gamut of other rubbish coding you see out there.
     
    deathshadow, Oct 28, 2008 IP
  16. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #36
    Not to perform necromancy, but I just linked someone to it and something occurred to me.

    Uhm, isn't typography presentation of the content, and therein has no place in the markup?

    Just saying... Separation of presentation from content. Typography is layout, layout does not go in the markup anymore.

    Which is why I use paragraphs in the grammatical sense, since we are supposed to be saying what things ARE, not how they APPEAR.
     
    deathshadow, Jul 3, 2009 IP
  17. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #37
    A bit unrelated, but the other argument for wrapping everyone and his cousin in p's is the "no inlines and blocks as siblings in the same box" argument. This causes some bugs in IE (including duplicate content), but the specs don't explicitly say it's illegal to have a block and an inline as siblings (and making the inlines blocks with CSS fixes the bugs anyway).

    The argument seems to rely on both the bugs, and the feeling that this:
    <a href="#"><img src="blah" width="" height="" alt="">some loose caption text <span>this needed to be a newline within caption text so it's display: block in the CSS</span></a>
    doesn't look right because the loose text sitting there isn't in a tag, even though as far as I know an anonymous inline box has the same amount of balls as an inline tag.

    <div>
    Some loose text
    <p>some inline text inside a block p</p>
    <a href="#">some inline text in an inline a</a>
    some more loose text
    </div>

    Well, it's legal, but it doesn't look right (semantics of loose text and p text aside). Does the DOM look different between the above and
    <div>
    <span>Some loose text</span>
    <p>some inline text inside a block p</p>
    <a href="#">some inline text in an inline a</a>
    <span>some more loose text</span>
    </div>
    ?
    Are there invisible \n nodes being added after each loose anonymous-inline word, and then after each tag?

    Anyway the argument was that you shouldn't do this:
    <div>
    <img src="#" w="" h="" alt="">
    <p>some text</p>
    </div>

    but that instead you should do this:
    <div>
    <p><img src="" w="" h="" alt=""></p>
    <p>some text</p>
    </div>

    (we're assuming the img does not belong in either case to the text below)

    One reason I don't do the latter is when I'm forced to have decorative content in the HTML, for floating reasons. The alt="" so even though it's in the HTML for practical reasons, it's not content in any way. So if it's not saying anything, how is it a paragraph?

    But I'll also use version 1 for content paragraphs as well. I see it as
    <div>
    <h?>Here's a header</h?>
    <img>alt text blah blah </img>
    <p>other text blah blah</p>
    <a href="#">Here's an anchor to blah blah</a>
    <ul>here is a list</ul>
    <table>here's a table</table>
    </div>

    So long as everyone is in their own tag, they are properly siblings of each other (assuming the content makes sense, that they are siblings and not children of each other and certainly not having some crazy incestuous markup tag soup orgies going on), I don't see why all the inlines there need to be wrapped in some J Random Block just to keep all the siblings blocks.

    I mean, you'd end up with this (because again my assumption is that the content says the anchor and the img aren't part of the existing p's and lists and tables):
    <div>
    <h?>Here's a header</h?>
    <p><img>alt text blah blah </img></p>
    <p>other text blah blah</p>
    <p><a href="#">Here's an anchor to blah blah</a></p>
    <ul>here is a list</ul>
    <table>here's a table</table>
    </div>
     
    Stomme poes, Jul 8, 2009 IP