Results 1 to 10 of 10

Thread: Is this a CSS issue?

  1. #1
    Join Date
    Jan 2009
    Posts
    16
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Is this a CSS issue?

    I'm trying to install this script on my page
    http://www.dynamicdrive.com/dynamicindex4/custom.htm

    I have the script part working well but I'm looking to customize (reduce) the "padding" between the drop down selection box and the image.
    I was thinking that adding a little border around the drop down box would also improve the astetics...Any suggestions?

    I'm not a builder, just trying to figure out how to make my own site look better.

    You can view the script here:
    http://www.stevesracingphotos.com/Products.htm
    Thanks for any suggestions and help.
    Steve

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I wouldn't use that script if I were you... on Fx3, it complains 'you need IE4 or NS4 to view the images!'

    Try this one:
    Code:
    <select class="galleryselect"
            onchange="document.getElementById('galleryimg').src = this.options[this.selectedIndex].value;">
      <option value="car.jpeg" selected>Car</option>
      <option value="/images/cat.png">Cat</option>
      <option value="http://www.example.com/dog.gif">Dog</option>
    </select>
    
    <img id="galleryimg" src="car.jpeg">
    (don't forget to link to a page where your non-JS users can view the images, too).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jan 2009
    Posts
    16
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    OK, Is there someplace I can see an example of the script?
    And will I have the same questions regarding the drop box?
    Thanks,
    Steve

  4. #4
    Join Date
    Jan 2009
    Posts
    16
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    OK, I have the new script running but it displays the image to the side.

    Forgive my question,but how do I get the selection boxUNDER or OVER the image?? I prefer under if possible.

    As stated earlier, I am not a coder, Just trying to get my site working the way I want it.
    Steve

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The select and the image can then be styled as .galleryselect and #galleryimg, respectively. As I have the layout there, it will be under it, if you apply:
    Code:
    .galleryselect {
      display: block;
    }
    
    #galleryimg {
      display: block;
    }
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. The Following User Says Thank You to Twey For This Useful Post:

    slamothe (01-16-2009)

  7. #6
    Join Date
    Jan 2009
    Posts
    16
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    OK, I think I have it pretty close except for applying the code that Twey has offered to place the selection box under the images.
    This is the first time I have messed with CSS. took a little expierimenting.

    The one last thing I would like to do is "center" the text in the drop down selection box. I expieriemented with CSS to try and get it to justfy to the center to no avail.
    I would appreciate a hint in the right direction to accomplish this.
    Or would it look funny centered?
    Thanks,
    Steve
    The new code is the one on second row HERE

    Thanks for the code and help Twey!!
    Last edited by slamothe; 01-16-2009 at 12:35 AM. Reason: add URL

  8. #7
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    I think it'd look funny centered but you can try it, maybe if you shortened the width as well? Did you try text-align:center; on the option tag? It might be more helpful next time if you say what you experimented with

  9. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    If you have an element around it like so:
    Code:
    <div class="gallery-container">
      <select class="gallery-select"
              onchange="document.getElementById('galleryimg').src = this.options[this.selectedIndex].value;">
        <option value="car.jpeg" selected>Car</option>
        <option value="/images/cat.png">Cat</option>
        <option value="http://www.example.com/dog.gif">Dog</option>
      </select>
    
      <img id="gallery-image" src="car.jpeg">
    </div>
    Then you can style it like so:
    Code:
    .gallery-select, #gallery-image {
      display: block;
      text-align: center;
    }
    
    .gallery-container {
      text-align: center;
    }
    As for your site: it doesn't conform to the DOCTYPE you gave it, but you'd probably be better off with HTML Strict anyway. Inline CSS is generally a bad idea because you lose the caching and maintenance benefits of the content–presentation separation CSS provides; you should make it external (put it in a separate text file with a .css extension, and add a link to it in your <head>: <link type="text/css" rel="stylesheet" href="/path/to/stylesheet.css">; use classes and IDs to specify which elements to style, as I've done above). Verdana is a bad choice for Web fonts, and whatever specific font you choose, make sure to provide a generic font family in case the user doesn't have that font (you don't want it reverting to monospace or something), e.g. font-family: Verdana, sans-serif;.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. The Following User Says Thank You to Twey For This Useful Post:

    slamothe (01-16-2009)

  11. #9
    Join Date
    Jan 2009
    Posts
    16
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Well most of what you told me to do sounded like Greek Language to me. Remember I'm not a web designer!!
    But I went to the validator page and just started laughing!!
    I WAS proud of myself for getting the script to work, Getting the selection box on top and getting it to look half way decent. I thought I nailed it!!
    Then I click on the validator page and got reminded that "I'm NOT A WEB DEVELOPER"...LOL
    But that's OK, I want it right so I will be reading and re-reading your suggestions and making changes to get it as close to perfectly correct as I can get it.
    I appreciate your helpfulness and patience, It must be trying with folks like me!!
    I could pay or ask someone to do it, But then I wouldnt learn a thing!!
    Thank You,
    Steve

  12. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    If you didn't understand something, please do tell me what so I can explain Read the Informative Links first, though.

    Don't worry too much — most professional Web developers are NOT WEB DEVELOPERS either Quite frustrating for us in the business.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •