SitePoint Sponsor

User Tag List

Results 1 to 25 of 268

Threaded View

  1. #1
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,350
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)

    CSS - Test Your CSS Skills Number 27

    CSS - Test Your CSS Skills Number 27 : Quiz now closed - Solution posted in post #126 (page 6)

    This week we have possibly the toughest quiz so far of all these quizzes and once again is something that was deemed impossible to do.

    Yurikolovsky has come up with a way of making a single level drop down that works in IE6 without any javascript.

    Whaaat! I hear you say "that's impossible".

    That's what I though until he told me he had a fully working version that uses valid html and css. As an exercise and before looking at his code I thought I'd give it a try and see if I could come up with something as I didn't want to set a quiz that nobody could do. After a few hours of fiddling around I managed to get a version working in IE6 although it is a little buggy but it did show me that it was possible to do and that there were perhaps a few other ways this could be done also.

    Look at the attached screenshot and you will see Yurikolvsky's menu in its normal and expanded state (and also a screenshot of my attempt).

    Your mission is therefore to create a single level drop down that will work in IE6 without javascript and also work in other browsers (though of course you can offer good browsers more advanced code etc).

    The basic rules are:

    valid css/html
    no tables
    no javascript
    No expressions/behaviours etc
    no conditional comments in the body of the html (conditional comments in the head of the page are acceptable )
    No invalid nested anchors.

    The top row of the menu should be a fluid width if possible although I will be lenient with the rules as this is a very hard task. The sub menus can be fixed width but I will be interested in any method that is working in some form or another.

    You can use your own html but I will reproduce the html from my example as a starting point.

    Code:
    <div id="navigation">
        <h1>IE6 only Demo</h1>
        <ul class="nav">
            <li><a class="target" href="#">Top Link1</a>
                <ul class="sub">
                    <li><a href="http://www.google.com/">Google</a></li>
                    <li><a href="http://www.yahoo.com/">Yahoo</a></li>
                    <li><a href="http://www.pmob.co.uk/">Pmob.co.uk</a></li>
                    <li><a href="#http://www.sitepoint.com/">Sitepoint</a></li>
                </ul>
            </li>
            <li><a class="target" href="#">Top Link2</a>
                <ul class="sub">
                    <li><a href="#1">Link1</a></li>
                    <li><a href="#2">Link2</a></li>
                    <li><a href="#3">Link3</a></li>
                    <li><a href="#4">Link4</a></li>
                </ul>
            </li>
            <li><a class="target" href="#">Top Link3</a>
                <ul class="sub">
                    <li><a href="#1">Link1</a></li>
                    <li><a href="#2">Link2</a></li>
                    <li><a href="#3">Link3</a></li>
                    <li><a href="#4">Link4</a></li>
                </ul>
            </li>
            <li><a class="target" href="#">Top Link4</a>
                <ul class="sub">
                    <li><a href="#1">Link1</a></li>
                    <li><a href="#2">Link2</a></li>
                    <li><a href="#3">Link3</a></li>
                    <li><a href="#4">Link4</a></li>
                </ul>
            </li>
        </ul>
    </div>
    <div class="content">
        <p>This is some following content : This is some following content : This is some following content : This is some following content : This is some following content : This is some following content : This is some following content : This is some following content : This is some following content : This is some following content : This is some following content : This is some following content : This is some following content : This is some following content : This is some following content : This is some following content : </p>
    </div>
    The above html is all that I needed for my example but as I mentioned already my example is a bit buggy and extra elements are used in Yurikolovskys example which makes it work flawlessly.

    NOTE:I know there is a clever version out there by Stu Nichols that doesn't use any javascript but Stu's version relies on the fact that a table is nested inside an anchor which is invalid. To make it valid the nested code is hidden using conditional comments in the html but in essence the code is still invalid but just hidden from the validator. It also means that the html is more complicated because of all the extra table tags and conditional comments on every level.

    That's the reason that I have not allowed any conditional comments in the body of the html and that the html must indeed be valid html and you can't just nest anchors.

    Oh and if you want to add tab support to the menu and it's drop down then feel free

    Edit:


    Here are some additional comments from Yurikolovsky that may aid with your task.
    Edit:


    i would also give the structure of this quiz, because
    essentially its 1 big quiz consisting out of (at least) 4 little quizzes

    to start: this is the dropdown
    MAIN LINK
    sublink
    sublink
    sublink

    1.- getting the main link to move the sublinks
    2.- getting the sublinks to move the sublinks
    3.- hiding the dropdown links when the main link is not being hovered
    4.- maintaining a background on the main link when the sublinks are being hovered (initially i thought this would be impossible)





    Any questions or if anything is unclear just ask and remember this is just for fun (although this solution will indeed be a workable solution for IE6)

    Solutions to the quiz will be posted at the end of the week (or longer) depending on how it goes

    Have fun .

    Paul

    PS. : In case you missed the other tests you can find them here:
    test 1: test 2: test 3: test 4: test 5: test 6: test 7: test 8: test9: test10: test11: test12:
    test13: test 14: test 15: test 16: test 17:test18 test 19:
    test 20 test 21: test 22:test 23 :test 24 : test 25: test 26
    Attached Images Attached Images


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
  •