simple aligning of text on two different sides of a div

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • realin
    Contributor
    • Feb 2007
    • 254

    simple aligning of text on two different sides of a div

    hi guys,

    i know i am really bad at CSS .. i just cant ever get things, the way i want to .. so in the end i have to compromise :(

    but i am asking you this question.. cause i cannot compromise in this..
    Well i want to adjust texts in to extreme sides of a div
    the source of the page is ::

    [CODE=html]
    <div class='info'>
    <img src=./ask/img/cup.gif width=50 height=50 id='uio' />
    <div id='dateinfo'>< ul><li>July12,2 009</li><li>kok</li></ul>
    </div>
    <div class='data'>ad min<br>
    39&nbsp;posts
    </div>
    </div>
    [/CODE]

    The CSS for this ::

    [CODE=css]
    .info{
    padding:5px 0px 0px 3px;
    background:#F3F 6FB;
    height:70px;
    margin-top:2px;
    border-bottom:1px solid #CDDAEF;

    }

    #dateinfo ul{
    float:right;
    position:relati ve;
    }
    #dateinfo li{
    list-style:none;
    }

    .data{
    margin-left:10px;
    float:left;

    }


    [/CODE]

    It shows perfect in IE but messed in FFx..
    there must be something to do with position and stuff..
    can you jus guide me.. thanks :)


    AND yeah here is the doctype which i am using
    [CODE=html]
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    <html xmlns="http://www.w3.org/1999/xhtml">
    [/CODE]
    Last edited by realin; Oct 1 '07, 06:07 PM. Reason: markup addition
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    The problem is IE, as always. While IE may be showing what you want, it is actually displaying a bug. Elements are NOT to expand to contain floated elements. Firefox is performing correctly.

    Just add 'overflow:auto' to #info and give it a little more height to accomodate the content. Also, don't forget quotes around your src for the image.

    Comment

    • realin
      Contributor
      • Feb 2007
      • 254

      #3
      Originally posted by drhowarddrfine
      The problem is IE, as always. While IE may be showing what you want, it is actually displaying a bug. Elements are NOT to expand to contain floated elements. Firefox is performing correctly.

      Just add 'overflow:auto' to #info and give it a little more height to accomodate the content. Also, don't forget quotes around your src for the image.
      hello,

      thanks for the reply.. now my info looks like


      [CODE=css].info{
      padding:5px 0px 0px 3px;
      background:#F3F 6FB;
      height:100px;
      margin-top:2px;
      border-bottom:1px solid #CDDAEF;
      overflow:auto;

      }[/CODE]


      but the problem is still there.. i have even enclosed the image name along with its path in single quotes, as it was left by chance.. but still no luck ..

      What do i do now ??

      thanks :)
      Last edited by realin; Oct 2 '07, 02:41 AM. Reason: Email notification

      Comment

      • drhowarddrfine
        Recognized Expert Expert
        • Sep 2006
        • 7434

        #4
        Are you clearing your cache? It works for me.

        Comment

        • realin
          Contributor
          • Feb 2007
          • 254

          #5
          Originally posted by drhowarddrfine
          Are you clearing your cache? It works for me.
          yup ofcourse i cleared the 50MB cache that ffx holds.. and refreshed it.. i also tried copying the above code to a new file test.html and opened but no luck :(

          it still gives the same problem ..
          Last edited by realin; Oct 2 '07, 05:00 AM. Reason: Email notification

          Comment

          • drhowarddrfine
            Recognized Expert Expert
            • Sep 2006
            • 7434

            #6
            Then I must misunderstand the problem. Originally you said you wanted "to adjust texts in to extreme sides of a div" which I wasn't sure what you meant, but I saw the div didn't expand to contain the floats so I thought that was the real problem. So I guess I lost sight of the real issue but I don't know what you mean by "adjust texts in to extreme sides of a div".

            Comment

            • realin
              Contributor
              • Feb 2007
              • 254

              #7
              Originally posted by drhowarddrfine
              Then I must misunderstand the problem. Originally you said you wanted "to adjust texts in to extreme sides of a div" which I wasn't sure what you meant, but I saw the div didn't expand to contain the floats so I thought that was the real problem. So I guess I lost sight of the real issue but I don't know what you mean by "adjust texts in to extreme sides of a div".
              its just like in here..
              see above the post..
              where the name realin is written and a pic is entitled

              on the right extreme we have the date and time and the thread or post number.

              so this way i wanna represent text..
              Last edited by realin; Oct 2 '07, 05:23 AM. Reason: Email notification

              Comment

              • drhowarddrfine
                Recognized Expert Expert
                • Sep 2006
                • 7434

                #8
                If you want the text on the right to have a margin, add 'margin-right:10px' to '#dateinfo ul'. If you do not want the margin on the left text, remove 'margin-left:10px' from '.data'.

                Comment

                • realin
                  Contributor
                  • Feb 2007
                  • 254

                  #9
                  i dont know why i am unable to explain you with the problem..
                  well this picture shows it all.. i want to remove the void i am showing in this pic.
                  this void isnt shown in IE though..
                  Unlimited space to host images, easy to use image uploader, albums, photo hosting, sharing, dynamic image resizing on web and mobile.


                  thanks
                  Last edited by realin; Oct 2 '07, 02:17 PM. Reason: Email notification

                  Comment

                  • recordlovelife
                    New Member
                    • Sep 2007
                    • 31

                    #10
                    it's the image on the left, try reversing these two lines...


                    [HTML]
                    <div id='dateinfo'>< ul><li>July12,2 009</li><li>kok</li></ul>
                    </div>
                    <img src=./ask/img/cup.gif width=50 height=50 id='uio' />
                    [/HTML]

                    im new at giving advise, normally taking it. so i hope it helps, and sorry if im wrong.

                    Comment

                    • drhowarddrfine
                      Recognized Expert Expert
                      • Sep 2006
                      • 7434

                      #11
                      Ah, now I see. English is not your native tongue so it wasn't quite clear what you wanted.

                      I didn't look at recordlovelife' s solution but, yes, the image is causing the gap. An image is 'inline' so it occupies the full width of the page. You can float the image left for a partial cure but you also need to remove the margins for the <ul>
                      [code=css]
                      .info{
                      padding:5px 0px 0px 3px;
                      background:#F3F 6FB;
                      height:70px;
                      margin-top:2px;
                      border-bottom:1px solid #CDDAEF;

                      }

                      #dateinfo ul{
                      float:right;
                      position:relati ve;margin-right:10px;
                      margin:0
                      }
                      #dateinfo li{
                      list-style:none;
                      }

                      .data{
                      margin-left:10px;
                      float:left;

                      }
                      .info img{
                      float:left
                      }[/code]

                      Comment

                      • realin
                        Contributor
                        • Feb 2007
                        • 254

                        #12
                        Originally posted by recordlovelife
                        it's the image on the left, try reversing these two lines...


                        [HTML]
                        <div id='dateinfo'>< ul><li>July12,2 009</li><li>kok</li></ul>
                        </div>
                        <img src=./ask/img/cup.gif width=50 height=50 id='uio' />
                        [/HTML]

                        im new at giving advise, normally taking it. so i hope it helps, and sorry if im wrong.
                        hi thanks for the help.. but still its the same :(

                        Comment

                        • realin
                          Contributor
                          • Feb 2007
                          • 254

                          #13
                          Originally posted by drhowarddrfine
                          Ah, now I see. English is not your native tongue so it wasn't quite clear what you wanted.

                          I didn't look at recordlovelife' s solution but, yes, the image is causing the gap. An image is 'inline' so it occupies the full width of the page. You can float the image left for a partial cure but you also need to remove the margins for the <ul>
                          [code=css]
                          .info{
                          padding:5px 0px 0px 3px;
                          background:#F3F 6FB;
                          height:70px;
                          margin-top:2px;
                          border-bottom:1px solid #CDDAEF;

                          }

                          #dateinfo ul{
                          float:right;
                          position:relati ve;margin-right:10px;
                          margin:0
                          }
                          #dateinfo li{
                          list-style:none;
                          }

                          .data{
                          margin-left:10px;
                          float:left;

                          }
                          .info img{
                          float:left
                          }[/code]

                          hey wow this just worked
                          much of thanks :)

                          Comment

                          • recordlovelife
                            New Member
                            • Sep 2007
                            • 31

                            #14
                            Originally posted by realin
                            hi thanks for the help.. but still its the same :(

                            in Safari, it fixes it. I just saw though, that in FF it doesn't. Ill keep pokin'.

                            Comment

                            • recordlovelife
                              New Member
                              • Sep 2007
                              • 31

                              #15
                              #dateinfo ul{
                              float:right;
                              margin:0;
                              padding:0;
                              }

                              that fixed it for me in Safari and FF

                              Comment

                              Working...