Hanging indents for links separated by <br>

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shannon Jacobs

    Hanging indents for links separated by <br>

    Maybe there is a simple trick here, and I'm not spotting it... Is there a
    guru of CSS hanging around here who can help out?

    The page in question has a multi-column table with a list of links in each
    column. Because links are added and deleted separately in each column, it
    would be exceedingly awkward to use a separate table row for each link.
    Therefore, within each column the links are separated by <br> tags. However,
    the automatic line wrap for long link descriptions causes them to appear to
    be two or more separate links. This makes it hard to pick out the proper
    links. A natural solution would be to use a hanging indent so that the first
    line of each actual link will stick out to the left.

    I thought I could do that with the usual hanging indent trick of a left
    margin and a negative text indent in the CSS, though it seems to be a bit
    unusual to do it to the A tag. However, what actually happens is that the
    first A tags in each TD do the right thing, but the later A tags ignore it.
    It seems like I can't associate the left indent with each A tag separately?

    Because this is an intranet page, I can't link directly to it, but this is a
    (sanitized) version of the links in one column.

    <TD valign="top">
    <DL>
    <DT>Category1 Description
    <DD>links
    <DT>Category2 Description
    <DD><A href="http://server1.com/link1">1st link description</A><BR>
    <A href="http://server2.com/link2">2nd link description</A>
    <DT>Category3 Description
    <DD><A href="http://server3.com/link3">3rd link description</A>
    <DT>Category4 Description
    <DD><A href="http://server4.com/link4">4th link description</A>
    <DT>Category5 Description
    <DD>links
    </DL>
    </TD>

    Here is the CSS snippet that fails:

    <STYLE type="text/css">
    <!--
    A{
    text-indent : -1pc;
    left : 1pc;
    }
    -->
    </STYLE>

    Suggestions or explanations will be greatly appreciated... However, now that
    I've written it out, I suspect the real problem may be that you can't get
    away with that kind of manipulation within the scope of a DL.

    There's probably a completely different and much better way to do it?

  • Spartanicus

    #2
    Re: Hanging indents for links separated by &lt;br&gt;

    "Shannon Jacobs" <shanen@cashett e.com> wrote:
    [color=blue]
    > left : 1pc;[/color]

    I've no idea what you are trying to do as you've made it particularly
    difficult for us to find out, but this may help:

    Pay particular attention to the "Applies to" information.

    Upload an example if you want further help (substitute the data if
    needed).

    --
    Spartanicus

    Comment

    • Els

      #3
      Re: Hanging indents for links separated by &lt;br&gt;

      Shannon Jacobs wrote:
      [color=blue]
      > The page in question has a multi-column table with a list of links in each
      > column. Because links are added and deleted separately in each column, it
      > would be exceedingly awkward to use a separate table row for each link.
      > Therefore, within each column the links are separated by <br> tags. However,
      > the automatic line wrap for long link descriptions causes them to appear to
      > be two or more separate links. This makes it hard to pick out the proper
      > links. A natural solution would be to use a hanging indent so that the first
      > line of each actual link will stick out to the left.
      >
      > I thought I could do that with the usual hanging indent trick of a left
      > margin and a negative text indent in the CSS, though it seems to be a bit
      > unusual to do it to the A tag. However, what actually happens is that the
      > first A tags in each TD do the right thing, but the later A tags ignore it.
      > It seems like I can't associate the left indent with each A tag separately?
      >
      > Because this is an intranet page, I can't link directly to it, but this is a
      > (sanitized) version of the links in one column.[/color]

      [snip code]
      [color=blue]
      > Here is the CSS snippet that fails:
      >
      > <STYLE type="text/css">
      > <!--
      > A{
      > text-indent : -1pc;
      > left : 1pc;
      > }
      > -->
      > </STYLE>[/color]

      That snippet fails even before I try it out:
      <!-- --> is for remarks, not for style rules.
      What is a pc?
      And what is 'left' supposed to do?

      If you can't show the real page, why don't you upload a working
      example to some server somewhere?
      Without seeing the rest of the CSS it's difficult to guess what is
      happening.

      [color=blue]
      > Suggestions or explanations will be greatly appreciated... However, now that
      > I've written it out, I suspect the real problem may be that you can't get
      > away with that kind of manipulation within the scope of a DL.[/color]

      A lot of manipulation is possible within a DL.
      [color=blue]
      > There's probably a completely different and much better way to do it?[/color]

      Have link descriptions that don't need wrapping? ;-)

      --
      Els http://locusmeus.com/
      Sonhos vem. Sonhos vão. O resto é imperfeito.
      - Renato Russo -
      Now playing: Human League - Together in Electric Dreams

      Comment

      • Johannes Koch

        #4
        Re: Hanging indents for links separated by &lt;br&gt;

        Els wrote:
        [color=blue]
        > What is a pc?[/color]

        pica <http://www.w3.org/TR/REC-CSS2/syndata.html#le ngth-units>

        --
        Johannes Koch
        In te domine speravi; non confundar in aeternum.
        (Te Deum, 4th cent.)

        Comment

        • Els

          #5
          Re: Hanging indents for links separated by &lt;br&gt;

          Johannes Koch wrote:
          [color=blue]
          > Els wrote:
          >[color=green]
          >> What is a pc?[/color]
          >
          > pica <http://www.w3.org/TR/REC-CSS2/syndata.html#le ngth-units>[/color]

          I did think of pica, but I never knew it could be used in HTML/CSS.
          Learned something new :-)

          --
          Els http://locusmeus.com/
          Sonhos vem. Sonhos vão. O resto é imperfeito.
          - Renato Russo -
          Now playing: Fleetwood Mac - Need Your Love So Bad

          Comment

          • Steve Fulton

            #6
            Re: Hanging indents for links separated by &lt;br&gt;

            Els wrote:
            [color=blue]
            > That snippet fails even before I try it out:
            > <!-- --> is for remarks, not for style rules.[/color]

            Only in XHTML. In HTML, the content of style elements is CDATA[1], not
            PCDATA. Since they're not parsed, <!-- and --> do not delimit comments
            inside <style> (and <script>[2]) tags. Only clients that do not recognize
            <style> tags will continue to parse the contents and treat <!-- --> as
            comment delimiters.

            Of course, anyone using clients that don't recognize <style> and
            <script> tags to browse today's web shouldn't be surprised to see their
            contents rendered.

            ---
            [1] <http://www.w3.org/TR/html401/sgml/dtd.html#StyleS heet>

            [2] <http://www.w3.org/TR/html401/sgml/dtd.html#Script >

            --
            Steve

            There is a foolish corner in the brain of the wisest man. -Aristotle

            Comment

            • Els

              #7
              Re: Hanging indents for links separated by &lt;br&gt;

              Steve Fulton wrote:
              [color=blue]
              > Els wrote:
              >[color=green]
              >> <!-- --> is for remarks, not for style rules.[/color]
              >
              > Only in XHTML. In HTML, the content of style elements is CDATA[1], not
              > PCDATA. Since they're not parsed, <!-- and --> do not delimit comments
              > inside <style> (and <script>[2]) tags. Only clients that do not recognize
              > <style> tags will continue to parse the contents and treat <!-- --> as
              > comment delimiters.[/color]

              Right, I keep learning new stuff :-)
              I didn't know of the existence of clients that don't recognize <style>
              and <script> element tags.

              --
              Els http://locusmeus.com/
              Sonhos vem. Sonhos vão. O resto é imperfeito.
              - Renato Russo -

              Comment

              • Shannon Jacobs

                #8
                Re: Hanging indents for links separated by &lt;br&gt;

                I don't mind your requests for additional information. I don't mind your
                complaints that you find my description of the problem too difficult to
                follow. I don't mind your ignorance, though it means your comments are
                unlikely to be helpful. I do mind your rudeness.

                Comment

                • Shannon Jacobs

                  #9
                  Re: Hanging indents for links separated by &lt;br&gt;

                  Spartanicus wrote:[color=blue]
                  > "Shannon Jacobs" <shanen@cashett e.com> wrote:
                  >[color=green]
                  >> left : 1pc;[/color]
                  >
                  > I've no idea what you are trying to do as you've made it particularly
                  > difficult for us to find out, but this may help:
                  > http://www.w3.org/TR/CSS21/visuren.html#position-props
                  > Pay particular attention to the "Applies to" information.
                  >
                  > Upload an example if you want further help (substitute the data if
                  > needed).[/color]

                  My apologies, though I felt that I had made some effort to describe the
                  problem clearly... I thank you for your reference, though it is well known.
                  I'm not quite clear why you felt the "Applies to" might be a key here, but I
                  am not using positioned elements here, so it seems inapplicable. (I may have
                  included some incorrect results from an earlier experiment?)

                  Not sure if this will help clarify the problem, but upon reflection, I had a
                  different idea around this slightly different statement of the problem: My
                  goal is to increase the separation between the listed links, while leaving
                  the separation within a link unchanged when the long link description is
                  wrapped to a new line. This approach does not require a hanging indent, but
                  only tinkering with the leading. Specifically, I tried this combination of
                  styles:

                  <STYLE type="text/css">
                  <!--
                  BODY{
                  line-height : 200%;
                  }
                  A{
                  line-height : 100%;
                  }
                  -->
                  </STYLE>

                  This actually works quite a bit better than the previous attempts with
                  hanging indents. The general leading of the page is spread out to 200%, and
                  within the links, the leading is back to 100%. Unfortunately, the line break
                  represented by a <br> tag is still not recognized as a place to insert the
                  non-A leading of 200%. The two consecutive A tags are given the normal
                  leading of 100%.

                  Anyway, thanks for your attempt (and the other attempts from other posters)
                  to be helpful. While I still believe there is probably an elegant CSS method
                  for achieving the desired results, I was able to get an acceptable
                  approximation of the desired effect by adding another level of list with a
                  <UL style="list-style-type : none"> tag, treating each of the links as a
                  list element. Unfortunately, this has frequently been my experience with
                  CSS, in that the time required to find a good solution is too long relative
                  to the time for a rough-and-ready approximate solution...

                  Comment

                  • Els

                    #10
                    Re: Hanging indents for links separated by &lt;br&gt;

                    Shannon Jacobs wrote:
                    [color=blue]
                    > I don't mind your requests for additional information. I don't mind your
                    > complaints that you find my description of the problem too difficult to
                    > follow. I don't mind your ignorance, though it means your comments are
                    > unlikely to be helpful. I do mind your rudeness.[/color]

                    Without quoting the parts of my message that you are replying to, it's
                    hard for me to understand which bit you found rude.

                    I just read my reply again, and I honestly don't see any rudeness in
                    it. WRT ignorance: I asked what a pc was, cause I didn't know pica was
                    an option. So, not knowing one thing makes me too ignorant to be
                    helpful? Can you please explain what you mean?

                    --
                    Els http://locusmeus.com/
                    Sonhos vem. Sonhos vão. O resto é imperfeito.
                    - Renato Russo -

                    Comment

                    • Spartanicus

                      #11
                      Re: Hanging indents for links separated by &lt;br&gt;

                      "Shannon Jacobs" <shanen@cashett e.com> wrote:
                      [color=blue][color=green][color=darkred]
                      >>> left : 1pc;[/color]
                      >>
                      >> I've no idea what you are trying to do as you've made it particularly
                      >> difficult for us to find out, but this may help:
                      >> http://www.w3.org/TR/CSS21/visuren.html#position-props
                      >> Pay particular attention to the "Applies to" information.
                      >>
                      >> Upload an example if you want further help (substitute the data if
                      >> needed).[/color]
                      >
                      >My apologies, though I felt that I had made some effort to describe the
                      >problem clearly... I thank you for your reference, though it is well known.
                      >I'm not quite clear why you felt the "Applies to" might be a key here, but I
                      >am not using positioned elements here, so it seems inapplicable. (I may have
                      >included some incorrect results from an earlier experiment?)[/color]

                      Only you can know, it's your code. The point is that specifying box
                      offsets as in the code you posted doesn't work on non positioned
                      elements.

                      We need a url to a minimised test case with actual content so that we
                      can check if you are using appropriate markup. Only then can we supply
                      proper advice on the css to use to get the desired presentation.
                      [color=blue]
                      >Unfortunatel y, this has frequently been my experience with
                      >CSS, in that the time required to find a good solution is too long relative
                      >to the time for a rough-and-ready approximate solution...[/color]

                      Web authoring used to be something that many people did by trial and
                      error, and copying and pasting. The bar has been raised substantially,
                      both in the technical correctness of the technologies used, and in the
                      available options. Not something to complain about imo. Unavoidably
                      modern web authoring does now require investing time to master the
                      skills.

                      --
                      Spartanicus

                      Comment

                      • Shannon Jacobs

                        #12
                        Re: Hanging indents for links separated by &lt;br&gt;

                        Spartanicus wrote:
                        <snip>[color=blue][color=green]
                        >> Unfortunately, this has frequently been my experience with
                        >> CSS, in that the time required to find a good solution is too long
                        >> relative to the time for a rough-and-ready approximate solution...[/color]
                        >
                        > Web authoring used to be something that many people did by trial and
                        > error, and copying and pasting. The bar has been raised substantially,
                        > both in the technical correctness of the technologies used, and in the
                        > available options. Not something to complain about imo. Unavoidably
                        > modern web authoring does now require investing time to master the
                        > skills.[/color]

                        I'm not really disagreeing with you on this, but I am actually using a
                        "high-powered" HTML editor that is supposed to make the capabilities of
                        styles more available at any level. I was using the default, which is at the
                        page level, but the same tool easily supports external CSS files or
                        individual items through a reasonably intuitive interface that has allowed
                        it to remain as the top HTML editor in Japan for many years. I admit that
                        I'm only a dabbler (though I've been dabbling for many years), but I still
                        feel like CSS is beyond the point of diminishing returns when you consider
                        the amount of effort required to achieve the desired effects. That's
                        probably "aggravated " by my strong focus on content over format, even though
                        I think the basic idea of separating content from the visual representation
                        is a good one... (As a prevert (sic) of sorts, I perhaps naturally tend to
                        JavaScript-based solutions.)

                        As it actually turned out, I rethought the problem yet one more time, and
                        came up with a much better solution without the extra level of <UL> that
                        required the repositioning. I had forgotten that you can have multiple <DD>
                        tags under each <DT>, and one link per <DD> works very well for my purpose
                        here. Another nice side effect is the elimination of the unpleasant <BR>
                        tags, but now I'm completely out of the CSS domain. I think (hope) this is a
                        minimal solution:

                        <DL>
                        <DT>Cat 1 Description
                        <DD>Link 1 [<A> tags omitted for clarity]
                        <DD>Link 2
                        <DT>Cat 2 Description
                        <DD>Link 3
                        <DD>Link 4
                        <DD>Link 5
                        ...
                        </DL>

                        Comment

                        • Spartanicus

                          #13
                          Re: Hanging indents for links separated by &lt;br&gt;

                          "Shannon Jacobs" <shanen@cashett e.com> wrote:
                          [color=blue][color=green][color=darkred]
                          >>> Unfortunately, this has frequently been my experience with
                          >>> CSS, in that the time required to find a good solution is too long
                          >>> relative to the time for a rough-and-ready approximate solution...[/color]
                          >>
                          >> Web authoring used to be something that many people did by trial and
                          >> error, and copying and pasting. The bar has been raised substantially,
                          >> both in the technical correctness of the technologies used, and in the
                          >> available options. Not something to complain about imo. Unavoidably
                          >> modern web authoring does now require investing time to master the
                          >> skills.[/color]
                          >
                          >I'm not really disagreeing with you on this, but I am actually using a
                          >"high-powered" HTML editor that is supposed to make the capabilities of
                          >styles more available at any level. I was using the default, which is at the
                          >page level, but the same tool easily supports external CSS files or
                          >individual items through a reasonably intuitive interface that has allowed
                          >it to remain as the top HTML editor in Japan for many years. I admit that
                          >I'm only a dabbler (though I've been dabbling for many years), but I still
                          >feel like CSS is beyond the point of diminishing returns when you consider
                          >the amount of effort required to achieve the desired effects.[/color]

                          Although css makes a lot of sense from a technical perspective, it is to
                          difficult to use for design oriented folk. Current authoring tools do a
                          poor job at shielding the aforementioned from the technical aspects of
                          web authoring in general, and css in particular. Until that changes
                          quality web authoring requires a technical expertise.
                          [color=blue]
                          >That's
                          >probably "aggravated " by my strong focus on content over format, even though
                          >I think the basic idea of separating content from the visual representation
                          >is a good one... (As a prevert (sic) of sorts, I perhaps naturally tend to
                          >JavaScript-based solutions.)[/color]

                          HTML, CSS and client side scripting should have very little overlap in
                          what they are used for.
                          [color=blue]
                          >As it actually turned out, I rethought the problem yet one more time, and
                          >came up with a much better solution without the extra level of <UL> that
                          >required the repositioning. I had forgotten that you can have multiple <DD>
                          >tags under each <DT>, and one link per <DD> works very well for my purpose
                          >here. Another nice side effect is the elimination of the unpleasant <BR>
                          >tags, but now I'm completely out of the CSS domain. I think (hope) this is a
                          >minimal solution:
                          >
                          ><DL>
                          > <DT>Cat 1 Description
                          > <DD>Link 1 [<A> tags omitted for clarity]
                          > <DD>Link 2
                          > <DT>Cat 2 Description
                          > <DD>Link 3
                          > <DD>Link 4
                          > <DD>Link 5
                          > ...
                          ></DL>[/color]

                          It's not possible to say for sure given that you continue to use bogus
                          content instead of supplying a url showing the real content and context,
                          but I suspect use of incorrect markup to achieve a certain
                          presentational effect, not the way to go.

                          --
                          Spartanicus

                          Comment

                          • Shannon Jacobs

                            #14
                            Re: Hanging indents for links separated by &lt;br&gt;

                            Spartanicus wrote:
                            <snip>[color=blue]
                            > It's not possible to say for sure given that you continue to use bogus
                            > content instead of supplying a url showing the real content and
                            > context, but I suspect use of incorrect markup to achieve a certain
                            > presentational effect, not the way to go.[/color]

                            Okay, I have to ask why you think it's incorrect markup? Insofar as it is
                            quite reasonable for a term to have several definitions, it seems to make
                            perfect sense to allow multiple <DD> tags under one <DT>, and the browsers
                            clearly know how to lay them out appropriately.

                            Having said that, I'll admit that I don't like the way this particular HTML
                            editor implements it. You either have to switch to the HTML view and work
                            directly on the tags, or you have to put a temporary <DT> element before
                            each to-be-adjacent <DD> tag and then delete the temps. It seems like the
                            natural implementation would be a sticky mode for <DL> input, and two
                            consecutive <Enter>s would result in consecutive <DD> tags (with a third
                            closing the DL).

                            On the other hand, it's a pretty minor nit, considering that I'm pretty sure
                            that most people don't use DLs in the first place...

                            Comment

                            • Spartanicus

                              #15
                              Re: Hanging indents for links separated by &lt;br&gt;

                              "Shannon Jacobs" <shanen@cashett e.com> wrote:
                              [color=blue][color=green]
                              >> It's not possible to say for sure given that you continue to use bogus
                              >> content instead of supplying a url showing the real content and
                              >> context, but I suspect use of incorrect markup to achieve a certain
                              >> presentational effect, not the way to go.[/color]
                              >
                              >Okay, I have to ask why you think it's incorrect markup?[/color]

                              Instead of me guessing the nature of your content, prove me wrong and
                              supply a url with some real content.

                              --
                              Spartanicus

                              Comment

                              Working...