correct equivalent construct for 1 line of code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ben C

    #16
    Re: correct equivalent construct for 1 line of code

    On 2007-04-16, pamela fluente <pamelafluente@ libero.itwrote:
    [...]
    Basically I have to make 3 kind of boxes:
    >
    1
    ><table style=" background-color: Aqua" >
    <tr>
    <td width="xx" height="yy" valign="top">
    Multiline text
    </td>
    </tr>
    ></table>
    >
    2
    >
    ><table style=" background-color: Aqua" >
    <tr>
    <td width="xx" height="yy" valign="middle" >
    Multiline text
    </td>
    </tr>
    ></table>
    >
    3
    >
    ><table style=" background-color: Aqua" >
    <tr>
    <td width="xx" height="yy" valign="bottom" >
    Multiline text
    </td>
    </tr>
    ></table>
    >
    where xx, yy are any number.
    >
    This is perfectly fine (because it can match perfectley the user's
    design).
    >
    HOWEVER. If there is a more correct way to have the *SAME* visual
    result on MSIE and FF using correct CSS instead of those 3 clumsy
    constructs, I will be happy.
    >
    All I need is the precise replacement for the above 3 king of boxes,
    done with
    correct CSS, to work with MSIE and FF. That's it. As simple as that.
    >
    Can you just do this simple tyny thing with CSS ? If not, don't be
    afraid to tell me so.
    It is possible in CSS using:

    1. display: inline-block and setting line-height. Or
    2. display: table-cell to do what you're doing anyway but without
    <tableelement s.

    (2) doesn't work in IE, (1) might, but doesn't work in FF.

    So realistically, it's not possible other than the way you're doing it.

    Comment

    • pamela fluente

      #17
      Re: correct equivalent construct for 1 line of code

      On 16 Apr, 17:58, Ben C <spams...@spam. eggswrote:
      >
      Can you just do this simple tyny thing with CSS ? If not, don't be
      afraid to tell me so.
      >
      It is possible in CSS using:
      >
      1. display: inline-block and setting line-height. Or
      2. display: table-cell to do what you're doing anyway but without
      <tableelement s.
      >
      (2) doesn't work in IE, (1) might, but doesn't work in FF.
      >
      So realistically, it's not possible other than the way you're doing it.-
      Hi Ben, Thanks for the straight answer.

      I had the suspect that here CSS has some design problem. It seems
      incredible they "forgot"
      to put this simple functionality in the "language", while almost any
      layout seems possible.

      Perhaps they understood that one would just use a table element for
      these cases. But it's
      really ugly (to me) to have to define an entire table just because
      one need to vertically align text
      in a box.

      It's rather disappointing :-( Isn't it?

      Let's hope some genius find a smart and elegant solution to that
      soon...

      -P




      Comment

      • Bergamot

        #18
        Re: correct equivalent construct for 1 line of code

        pamela fluente wrote:
        >
        I will tell you the REAL problem . But please try to stick to the
        point
        Perhaps you don't realize that this is a discussion group, hence we
        discuss things here. That includes whether what you want to do is
        advisable in the first place. Welcome to Usenet.
        The user has an interface (EXE application) where there are some
        objects he can edit using a GUI.
        >
        These objects are basically "boxes" with multiline text inside.
        >
        The user can drag the objects as he wish with the mouse and can put
        any text in it.
        Sounds like a so-called WYSIWYG web authoring tool. I have visions of
        absolutely positioned text elements scattered all over the page, which
        overlap other elements when there is the slightest variation in the
        user's text size. :-(
        <td width="xx" height="yy" valign="top">
        Multiline text
        </td>
        <td width="xx" height="yy" valign="middle" >
        Multiline text
        </td>
        <td width="xx" height="yy" valign="bottom" >
        Multiline text
        </td>
        >
        where xx, yy are any number.
        >
        This is perfectly fine (because it can match perfectley the user's
        design).
        Whether it matches the user's design perfectly isn't important. Whether
        the resulting web page is usable by the target audience is.
        HOWEVER. If there is a more correct way to have the *SAME* visual
        result on MSIE and FF using correct CSS instead of those 3 clumsy
        constructs, I will be happy.
        Ben gave you some suggestions for replacing tables, but they aren't
        really viable alternatives. Regardless, setting precise height and width
        on text blocks is a bad idea, especially if setting dimensions in px,
        which I'm sure you are doing. At least with table markup, those
        dimensions are treated as minimums and the cell will expand if need be.
        I still have visions of these boxes absolutely positioned in a fragile
        layout.

        The whole idea sounds flawed to me, but you haven't really given us the
        whole picture, so I could be overly pessimistic. Tell me I'm wrong, please.
        Can you just do this simple tyny thing with CSS ? If not, don't be
        afraid to tell me so.
        I would bet that Visual Studio isn't really very bright, but it appeared
        to be clever by telling you there is a more modern way to code something.
        If yes please just give the code first. Then we can discuss forever on
        it.
        You might as well stick with what you have. The only usable alternative
        is dropping the width, height and valign attributes and using inline
        styles instead. That doesn't really buy you much. The output will still
        be guaranteed usable (more or less) only by the person who designed it.

        Unless my guesses about the app are all wrong, that is.

        --
        Berg

        Comment

        • Ben C

          #19
          Re: correct equivalent construct for 1 line of code

          On 2007-04-16, pamela fluente <pamelafluente@ libero.itwrote:
          On 16 Apr, 17:58, Ben C <spams...@spam. eggswrote:
          >
          >>
          Can you just do this simple tyny thing with CSS ? If not, don't be
          afraid to tell me so.
          >>
          >It is possible in CSS using:
          >>
          >1. display: inline-block and setting line-height. Or
          >2. display: table-cell to do what you're doing anyway but without
          > <tableelement s.
          >>
          >(2) doesn't work in IE, (1) might, but doesn't work in FF.
          >>
          >So realistically, it's not possible other than the way you're doing it.-
          >
          Hi Ben, Thanks for the straight answer.
          >
          I had the suspect that here CSS has some design problem. It seems
          incredible they "forgot"
          to put this simple functionality in the "language", while almost any
          layout seems possible.
          Well the functionality is there though, it's just that IE and FF
          "forgot" to implement it all properly :)

          Comment

          • pamela fluente

            #20
            Re: correct equivalent construct for 1 line of code

            On 16 Apr, 20:10, Bergamot <berga...@visi. comwrote:
            Perhaps you don't realize that this is a discussion group, hence we
            discuss things here. That includes whether what you want to do is
            advisable in the first place. Welcome to Usenet.
            thanks :-)
            Sounds like a so-called WYSIWYG web authoring tool. I have visions of
            absolutely positioned text elements scattered all over the page, which
            overlap other elements when there is the slightest variation in the
            user's text size. :-(
            Yes similar. But it's not meant to make web pages. Web pages are
            considered
            an "export" and they are supposed to reflect strictly the uder design.
            Whether it matches the user's design perfectly isn't important. Whether
            the resulting web page is usable by the target audience is.
            In my case actually strict adherence is a wanted quality of the
            "export".
            Ben gave you some suggestions for replacing tables, but they aren't
            really viable alternatives. Regardless, setting precise height and width
            on text blocks is a bad idea, especially if setting dimensions in px,
            which I'm sure you are doing. At least with table markup, those
            dimensions are treated as minimums and the cell will expand if need be.
            I still have visions of these boxes absolutely positioned in a fragile
            layout.
            yes
            >
            The whole idea sounds flawed to me, but you haven't really given us the
            whole picture, so I could be overly pessimistic. Tell me I'm wrong, please.
            See it as an export of something else. Not like a masterpiece web
            page.
            It's an export that must be as close as possible to the original
            work ,
            which may be exported also in other format such as PDF. And all export
            must look equal to the original.
            I would bet that Visual Studio isn't really very bright, but it appeared
            to be clever by telling you there is a more modern way to code something.
            I will vote for VS as the best piece of software ever.
            You might as well stick with what you have. The only usable alternative
            is dropping the width, height and valign attributes and using inline
            styles instead. That doesn't really buy you much. The output will still
            be guaranteed usable (more or less) only by the person who designed it.
            Let's do that. I am not sure what you mean. I tried

            <table style=" background-color: Aqua" >
            <tr>
            <td style="width:92 ; height:38" valign="top">
            AnyThing
            </td>
            </tr>
            </table>


            but it does not seem to give the same result as

            <table style=" background-color: Aqua" >
            <tr>
            <td width="92" height="38" valign="top">
            AnyThing
            </td>
            </tr>
            </table>

            Could you clarify what you mean with the right code?
            >
            Unless my guesses about the app are all wrong, that is.
            Nope. They are quite right.
            >
            --
            Berg
            Thank you Berg,

            -Pam

            Comment

            • pamela fluente

              #21
              Re: correct equivalent construct for 1 line of code

              On 16 Apr, 20:16, Ben C <spams...@spam. eggswrote:
              On 2007-04-16, pamela fluente <pamelaflue...@ libero.itwrote:
              >
              >
              >
              >
              >
              On 16 Apr, 17:58, Ben C <spams...@spam. eggswrote:
              >
              Can you just do this simple tyny thing with CSS ? If not, don't be
              afraid to tell me so.
              >
              It is possible in CSS using:
              >
              1. display: inline-block and setting line-height. Or
              2. display: table-cell to do what you're doing anyway but without
              <tableelement s.
              >
              (2) doesn't work in IE, (1) might, but doesn't work in FF.
              >
              So realistically, it's not possible other than the way you're doing it.-
              >
              Hi Ben, Thanks for the straight answer.
              >
              I had the suspect that here CSS has some design problem. It seems
              incredible they "forgot"
              to put this simple functionality in the "language", while almost any
              layout seems possible.
              >
              Well the functionality is there though, it's just that IE and FF
              "forgot" to implement it all properly :)- Nascondi testo tra virgolette -
              Ah Really? Too bad.

              What would be the functionality that has not been implemented ? And
              why they both skipped this fundamental one?
              Did the spec deliver too late?

              -P

              Comment

              • pamela fluente

                #22
                Re: correct equivalent construct for 1 line of code

                On 16 Apr, 21:34, "pamela fluente" <pamelaflue...@ libero.itwrote:
                On 16 Apr, 20:10, Bergamot <berga...@visi. comwrote:
                >
                Could you clarify what you mean with the right code?
                Ah ok. I spot the error. Didn't specify the unit. Evidently it does
                not assume px.

                -P
                >
                >
                Thank you Berg,
                >
                -Pam

                Comment

                • Bergamot

                  #23
                  Re: correct equivalent construct for 1 line of code

                  pamela fluente wrote:
                  On 16 Apr, 20:10, Bergamot <berga...@visi. comwrote:
                  >
                  >Whether it matches the user's design perfectly isn't important. Whether
                  >the resulting web page is usable by the target audience is.
                  >
                  may be exported also in other format such as PDF. And all export
                  must look equal to the original.
                  Now it really sounds flawed. Web media is different from PDF or other
                  print media. Looking "equal" isn't really part of the equation, you just
                  don't realize it.
                  >You might as well stick with what you have. The only usable alternative
                  >is dropping the width, height and valign attributes and using inline
                  >styles instead.
                  >
                  Let's do that. I am not sure what you mean. I tried
                  <td style="width:92 ; height:38" valign="top">
                  You already figured out you need units on a non-zero value, but also
                  drop attribute valign for CSS property vertical-align.
                  >Unless my guesses about the app are all wrong, that is.
                  >
                  Nope. They are quite right.
                  As I feared. :(

                  --
                  Berg

                  Comment

                  • pamela fluente

                    #24
                    Re: correct equivalent construct for 1 line of code

                    On 16 Apr, 22:35, Bergamot <berga...@visi. comwrote:
                    pamela fluente wrote:
                    On 16 Apr, 20:10, Bergamot <berga...@visi. comwrote:
                    >
                    Now it really sounds flawed. Web media is different from PDF or other
                    print media. Looking "equal" isn't really part of the equation, you just
                    don't realize it.
                    Well in my case I have to make compromises. A page can have a lot
                    (thousands)
                    of objects each one depending on the position of many other ones.
                    And actually an objective of the whole export is to be exactly equal
                    to the original.
                    I cannot allow object to freely move because otherwise all the
                    assembly
                    effect is going to be sboiled.
                    I know you do not want to hear that, but it's a "pixel precision"
                    composition.
                    Every object is fixed in the position where the user put it at design
                    time. To change
                    it, he can "redesign" the original.

                    Not quite a web page, as you intend it :-)
                    >
                    You already figured out you need units on a non-zero value, but also
                    drop attribute valign for CSS property vertical-align.
                    ah thanks, perfect:

                    <table style=" background-color: Aqua" >
                    <tr>
                    <td style="width:92 px; height:38px; vertical-align:top">
                    AnyThing
                    </td>
                    </tr>
                    </table>

                    It's still quite ugly, but at least I do not have the warnings !

                    Another reason why I was looking for alternative syntax is that the
                    above is quite
                    redundant for just a box (or a "cell"). Each <td></tdcalls for a
                    <tableand <tr>
                    so there is a lot of overhead. And I might have thousands of those
                    boxes on a document...

                    Really ugly, but there seems to be no other choice. Because each box
                    can be positioned independently.


                    -P


                    Comment

                    • Ben C

                      #25
                      Re: correct equivalent construct for 1 line of code

                      On 2007-04-16, pamela fluente <pamelafluente@ libero.itwrote:
                      On 16 Apr, 20:16, Ben C <spams...@spam. eggswrote:
                      >On 2007-04-16, pamela fluente <pamelaflue...@ libero.itwrote:
                      >>
                      >>
                      >>
                      >>
                      >>
                      On 16 Apr, 17:58, Ben C <spams...@spam. eggswrote:
                      >>
                      Can you just do this simple tyny thing with CSS ? If not, don't be
                      afraid to tell me so.
                      >>
                      >It is possible in CSS using:
                      >>
                      >1. display: inline-block and setting line-height. Or
                      >2. display: table-cell to do what you're doing anyway but without
                      > <tableelement s.
                      >>
                      >(2) doesn't work in IE, (1) might, but doesn't work in FF.
                      >>
                      >So realistically, it's not possible other than the way you're doing it.-
                      >>
                      Hi Ben, Thanks for the straight answer.
                      >>
                      I had the suspect that here CSS has some design problem. It seems
                      incredible they "forgot"
                      to put this simple functionality in the "language", while almost any
                      layout seems possible.
                      >>
                      >Well the functionality is there though, it's just that IE and FF
                      >"forgot" to implement it all properly :)- Nascondi testo tra virgolette -
                      >
                      Ah Really? Too bad.
                      >
                      What would be the functionality that has not been implemented ?
                      display: inline-block and display: table, display: table-cell, etc.
                      And why they both skipped this fundamental one?
                      I don't know why Firefox skipped inline-block as it is so useful (for
                      lots of other things, it's not the best way to do this particular one,
                      tables are better). As for Microsoft they don't give the impression that
                      they particularly aim to be useful anyway.

                      Comment

                      • Bergamot

                        #26
                        Re: correct equivalent construct for 1 line of code

                        pamela fluente wrote:
                        >
                        I know you do not want to hear that, but it's a "pixel precision"
                        composition.
                        Which means that HTML is the wrong tool for the job.

                        --
                        Berg

                        Comment

                        • Jukka K. Korpela

                          #27
                          Re: correct equivalent construct for 1 line of code

                          Scripsit pamela fluente:
                          >You are not going to tell us the _real_ problem, are you?
                          >
                          I will tell you the REAL problem . But please try to stick to the
                          point
                          if you do not know the answer of this is impossible to do with CSS
                          just tell me so.
                          I don't like your tone of voice, and I still haven't seen your URL.

                          I have already given you the CSS answer, to the extent that your question
                          was about CSS (in the most obvious way: in achieving in "pure CSS" the
                          visual impression that you seem to be aiming at using a layout table).
                          If yes please just give the code first. Then we can discuss forever on
                          it.
                          There's little point in discussing when you're asking wrong questions and
                          don't even understand the answers to them.

                          --
                          Jukka K. Korpela ("Yucca")


                          Comment

                          • =?ISO-8859-1?Q?G=E9rard_Talbot?=

                            #28
                            Re: correct equivalent construct for 1 line of code

                            Bergamot wrote :
                            Gérard Talbot wrote:
                            >Also, some browsers and some browser versions have bugs on
                            >vertical-alignment in table cells. Here's a convincing testcase which
                            >the MSIE7 fails:
                            >>
                            >http://www.hixie.ch/tests/adhoc/css/box/table/003.html
                            >
                            FYI, the issue here is not vertical alignment in table cells,
                            Indirectly, yes.
                            "<title>CSS table model: vertical-align on columns (shouldn't do
                            anything)</title>"
                            it's
                            styling <col>, which is something else altogether.
                            If vertical-align should not apply to <colelements ...
                            >
                            BTW, while IE apparently allows <colstyling that it shouldn't,
                            Correct.

                            gecko
                            browsers support almost no <colstyling at all
                            Well, it does not support (and it shouldn't) vertical-align css
                            declaration on <col>.

                            vertical-align Applies to: inline-level and 'table-cell' elements
                            according to latest CSS 2.1 spec:


                            , so they'd ignore just
                            about any style rules there, not just vertical-align.
                            What remains afterwards should be the default vertical-align value for
                            each table cells. For table cells, that is middle.
                            The default vertical-alignment of data in table cells in all browsers is middle.
                            was in my original post.

                            thead, tbody,
                            tfoot { vertical-align: middle }
                            td, th { vertical-align: inherit }
                            Default style sheet for HTML 4 (informative, not normative, I must say..)


                            Gérard
                            --
                            Using Web Standards in your Web Pages (Updated Dec. 2006)
                            The MDN Web Docs site provides information about Open Web technologies including HTML, CSS, and APIs for both Web sites and progressive web apps.

                            Comment

                            Working...