css question

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

    css question

    Is this possbile with css or do I need to use javascript? If so how?

    <div class="a1" style="width:10 0%"><img src="test.jpg" /></div>

    The width of the div is a variable. Can I scale the img accordingly?
    img width is 80% of the width of the div


    Tem
  • Nick Chan

    #2
    Re: css question

    could u do something like this?

    <div class="a1" style="width:10 0%"><img src="test.jpg" style="width:
    80%" /></div>


    On Nov 6, 1:22 pm, "Tem" <tem1...@yahoo. comwrote:
    Is this possbile with css or do I need to use javascript? If so how?
    >
    <div class="a1" style="width:10 0%"><img src="test.jpg" /></div>
    >
    The width of the div is a variable. Can I scale the img accordingly?
    img width is 80% of the width of the div
    >
    Tem

    Comment

    • Tem

      #3
      Re: css question

      That won't work because I need to set the width of the image, 80% of the
      width of the parent element, the div.
      Can this be done with CSS?

      "Nick Chan" <zzzxtreme@yaho o.comwrote in message
      news:1194345302 .205603.6240@e3 4g2000pro.googl egroups.com...
      could u do something like this?
      >
      <div class="a1" style="width:10 0%"><img src="test.jpg" style="width:
      80%" /></div>
      >
      >
      On Nov 6, 1:22 pm, "Tem" <tem1...@yahoo. comwrote:
      >Is this possbile with css or do I need to use javascript? If so how?
      >>
      ><div class="a1" style="width:10 0%"><img src="test.jpg" /></div>
      >>
      >The width of the div is a variable. Can I scale the img accordingly?
      >img width is 80% of the width of the div
      >>
      >Tem
      >
      >

      Comment

      • Kevin Spencer

        #4
        Re: css question

        If you had tried Nick's suggestion, you would have seen that this is exactly
        what it does.

        --
        HTH,

        Kevin Spencer
        Chicken Salad Surgeon
        Microsoft MVP

        "Tem" <tem1232@yahoo. comwrote in message
        news:ewLEByLIIH A.4688@TK2MSFTN GP06.phx.gbl...
        That won't work because I need to set the width of the image, 80% of the
        width of the parent element, the div.
        Can this be done with CSS?
        >
        "Nick Chan" <zzzxtreme@yaho o.comwrote in message
        news:1194345302 .205603.6240@e3 4g2000pro.googl egroups.com...
        >could u do something like this?
        >>
        ><div class="a1" style="width:10 0%"><img src="test.jpg" style="width:
        >80%" /></div>
        >>
        >>
        >On Nov 6, 1:22 pm, "Tem" <tem1...@yahoo. comwrote:
        >>Is this possbile with css or do I need to use javascript? If so how?
        >>>
        >><div class="a1" style="width:10 0%"><img src="test.jpg" /></div>
        >>>
        >>The width of the div is a variable. Can I scale the img accordingly?
        >>img width is 80% of the width of the div
        >>>
        >>Tem
        >>
        >>
        >

        Comment

        • Tem

          #5
          Re: css question

          Thanks. how do I center the image in the div?

          "Kevin Spencer" <unclechutney@n othinks.comwrot e in message
          news:OBmMmZTIIH A.4688@TK2MSFTN GP06.phx.gbl...
          If you had tried Nick's suggestion, you would have seen that this is
          exactly what it does.
          >
          --
          HTH,
          >
          Kevin Spencer
          Chicken Salad Surgeon
          Microsoft MVP
          >
          "Tem" <tem1232@yahoo. comwrote in message
          news:ewLEByLIIH A.4688@TK2MSFTN GP06.phx.gbl...
          >That won't work because I need to set the width of the image, 80% of the
          >width of the parent element, the div.
          >Can this be done with CSS?
          >>
          >"Nick Chan" <zzzxtreme@yaho o.comwrote in message
          >news:119434530 2.205603.6240@e 34g2000pro.goog legroups.com...
          >>could u do something like this?
          >>>
          >><div class="a1" style="width:10 0%"><img src="test.jpg" style="width:
          >>80%" /></div>
          >>>
          >>>
          >>On Nov 6, 1:22 pm, "Tem" <tem1...@yahoo. comwrote:
          >>>Is this possbile with css or do I need to use javascript? If so how?
          >>>>
          >>><div class="a1" style="width:10 0%"><img src="test.jpg" /></div>
          >>>>
          >>>The width of the div is a variable. Can I scale the img accordingly?
          >>>img width is 80% of the width of the div
          >>>>
          >>>Tem
          >>>
          >>>
          >>
          >
          >

          Comment

          • Kevin Spencer

            #6
            Re: css question

            Put the image inside a div with the div's width style set to "1px", and its'
            left-margin and right-margin styles set to "auto". Put the div inside the
            div you want to center the image in. The inner div will stretch its' width
            to accomodate the image and be centered in the outer div.

            --
            HTH,

            Kevin Spencer
            Chicken Salad Surgeon
            Microsoft MVP

            "Tem" <tem1232@yahoo. comwrote in message
            news:eATD6KWIIH A.1164@TK2MSFTN GP02.phx.gbl...
            Thanks. how do I center the image in the div?
            >
            "Kevin Spencer" <unclechutney@n othinks.comwrot e in message
            news:OBmMmZTIIH A.4688@TK2MSFTN GP06.phx.gbl...
            >If you had tried Nick's suggestion, you would have seen that this is
            >exactly what it does.
            >>
            >--
            >HTH,
            >>
            >Kevin Spencer
            >Chicken Salad Surgeon
            >Microsoft MVP
            >>
            >"Tem" <tem1232@yahoo. comwrote in message
            >news:ewLEByLII HA.4688@TK2MSFT NGP06.phx.gbl.. .
            >>That won't work because I need to set the width of the image, 80% of the
            >>width of the parent element, the div.
            >>Can this be done with CSS?
            >>>
            >>"Nick Chan" <zzzxtreme@yaho o.comwrote in message
            >>news:11943453 02.205603.6240@ e34g2000pro.goo glegroups.com.. .
            >>>could u do something like this?
            >>>>
            >>><div class="a1" style="width:10 0%"><img src="test.jpg" style="width:
            >>>80%" /></div>
            >>>>
            >>>>
            >>>On Nov 6, 1:22 pm, "Tem" <tem1...@yahoo. comwrote:
            >>>>Is this possbile with css or do I need to use javascript? If so how?
            >>>>>
            >>>><div class="a1" style="width:10 0%"><img src="test.jpg" /></div>
            >>>>>
            >>>>The width of the div is a variable. Can I scale the img accordingly?
            >>>>img width is 80% of the width of the div
            >>>>>
            >>>>Tem
            >>>>
            >>>>
            >>>
            >>
            >>
            >

            Comment

            • Nick Chan

              #7
              Re: css question

              u could try
              <div style="text-align:middle (or center);blabla <img bla bla

              On Nov 7, 12:21 pm, "Tem" <tem1...@yahoo. comwrote:
              Thanks. how do I center the image in the div?
              >
              "Kevin Spencer" <unclechut...@n othinks.comwrot e in message
              >
              news:OBmMmZTIIH A.4688@TK2MSFTN GP06.phx.gbl...
              >
              If you had tried Nick's suggestion, you would have seen that this is
              exactly what it does.
              >
              --
              HTH,
              >
              Kevin Spencer
              Chicken Salad Surgeon
              Microsoft MVP
              >
              "Tem" <tem1...@yahoo. comwrote in message
              news:ewLEByLIIH A.4688@TK2MSFTN GP06.phx.gbl...
              That won't work because I need to set the width of the image, 80% of the
              width of the parent element, the div.
              Can this be done with CSS?
              >
              "Nick Chan" <zzzxtr...@yaho o.comwrote in message
              >news:119434530 2.205603.6240@e 34g2000pro.goog legroups.com...
              >could u do something like this?
              >
              ><div class="a1" style="width:10 0%"><img src="test.jpg" style="width:
              >80%" /></div>
              >
              >On Nov 6, 1:22 pm, "Tem" <tem1...@yahoo. comwrote:
              >>Is this possbile with css or do I need to use javascript? If so how?
              >
              >><div class="a1" style="width:10 0%"><img src="test.jpg" /></div>
              >
              >>The width of the div is a variable. Can I scale the img accordingly?
              >>img width is 80% of the width of the div
              >
              >>Tem


              Comment

              • Savio

                #8
                Re: css question

                On 2007-11-06, Tem <tem1232@yahoo. comwrote:
                Is this possbile with css or do I need to use javascript? If so how?
                >
                ><div class="a1" style="width:10 0%"><img src="test.jpg" /></div>
                >
                The width of the div is a variable. Can I scale the img accordingly?
                img width is 80% of the width of the div
                >
                Why don't you apply the stype to the <imgobject? :-)

                <img src="a.gif" style="width:10 0%"/>

                regards,

                --
                Savio

                Comment

                Working...