SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Ignoring Browser Style Sheets - Facebook

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2009
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ignoring Browser Style Sheets - Facebook

    So I noticed when I make the font in IE bigger using "view->text size->largest", that it has no affect on the font size in facebook. Can anyone tell me how I can do this?

    Little background info on why I'd like to do this because maybe someone can suggest another work around...

    I'm creating a horizontal navigation menu using an unordered list, with certain menu items having drop down menus containing another unordered list.

    So the structure of the html would be something like...

    HTML Code:
    <ul id="main_nav">
    		<li><h4><a href="">Option 1</a></h4></li>
    		<li>
    		  <h4><a href="">Option 2</a></h4>
    		  <div class="sub_menu">
    		    <ul>
    		    	<li>Sub option 1</li>
    		    	<li>Sub option 2</li>
    		    	<li>Sub option 3</li>
    		   </ul>
    		  </div>
    		</li>
    		<li><h4><a href="">Option 3</a></h4></li>
    		<li><h4><a href="">Option 4</a></h4></li>
    	 
    	</ul>

    To position the drop down(sub_menu), I am trying the following...


    1. Give the navigation bar a height, say 30px.
    2. Set position:relative on the li elements (so I can position the nested unordered lists relative to appropriate menu item)
    3. Set position: absolute on the sub_menu div and top:30px (or whatever height of navigation bar is) and left:0

    I guess I'm not really sure how else to position the drop down without knowing the height of the navigation bar. But at the same time, I know adding the height creates a situation where an overflow can occur if the user sets their font really large, so I know there has to be a better way.

    Any feedback would be appreciated. Thanks.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    15,824
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    That's a bug in some versions of IE where font sizes set in pixels don't get resized.

    The bug can be corrected by overriding pixel font sizes with ems in a stylesheet attached to the browser but most people using the old versions of IE with that bug don't know how to do that.

    Apart from that the font sizes your visitor chooses can't be blocked by the web page.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2009
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    That's a bug in some versions of IE where font sizes set in pixels don't get resized.

    The bug can be corrected by overriding pixel font sizes with ems in a stylesheet attached to the browser but most people using the old versions of IE with that bug don't know how to do that.

    Apart from that the font sizes your visitor chooses can't be blocked by the web page.
    Thanks for the info on IE. I had a feeling I wouldn't be able to rely on that to prevent overflows, but it was interesting that facebook seemed to be getting around it. Apparently I just need to upgrade my IE.

    Anyone have any insight on the proper way to position a drop down menu, without knowing the height of the main horizontal menu that it drops down from?

  4. #4
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,564
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Alll IE don't get pixels resized. Not just a few .

    Knowing Facebook there is probably a script (if possible)

    What you might be seeing (however) is just a zoom of the text?
    Twitter-@Ryan_Reese09
    http://www.ryanreese.us -Always looking for web design/development work

  5. #5
    The CSS Clinic is open silver trophybronze trophy
    SitePoint Award Recipient Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    37,793
    Mentioned
    99 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by anonymousdude View Post
    Anyone have any insight on the proper way to position a drop down menu, without knowing the height of the main horizontal menu that it drops down from?
    In most cases you can use top:auto instead of using a dimension. In the following example you can resize the text and the drop down always stays in contact with the top menu.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--[if lt IE 7]>
    <script type="text/javascript">
    
    sfHover = function() {
        var sfEls = document.getElementById("nav").getElementsByTagName("LI");
        for (var i=0; i<sfEls.length; i++) {
            sfEls[i].onmouseover=function() {
                this.className+=" over";
            }
            sfEls[i].onmouseout=function() {
                this.className=this.className.replace(new RegExp(" over\\b"), "");
            }
        }
    }
    if (window.attachEvent) window.attachEvent("onload", sfHover);
    
    </script>
    <![endif]-->
    <style type="text/css">
    body {
        font-family:Verdana, Arial, Helvetica, sans-serif;
        font-size:100%;
    }
    ul#nav{font-size:62.5%}
    ul#nav, ul#nav ul {
        margin: 0;
        padding: 0;
        list-style: none;
    }
    ul#nav li {
        position: relative;
        float: left;
        width:149px;
    }
    #nav li ul {
        position: absolute;
        left: 0; 
        top: auto;
        margin-left:-999em;
    }
    #nav li  li{width:149px;}
    #nav li ul ul {
        position: absolute;
        left:100%;
        top: -.1em;
        margin-left:-999em;
    }
    ul#nav li a {
        display: block;
        text-decoration: none;
        color: #777;
        background: #fffccc; /* IE6 likes a background here */
        padding: 5px;
        border: 1px solid #ccc;
    }
    /* commented backslash mac hiding hack \*/ 
    * html ul#nav li a {
        height:1%
    }
    /* end hack */ 
    
    /* this sets all hovered lists to red */
    #nav li:hover a, #nav li.over a, #nav li:hover li:hover a, #nav li.over li.over a, #nav li:hover li:hover li:hover a, #nav li.over li.over li.over a, #nav li:hover li a:hover, #nav li.over li a:hover, #nav li:hover li:hover li:hover a:hover, #nav li.over li li a:hover, #nav li:hover li:hover li:hover li:hover a:hover, #nav li.over li.over li.over li.over a:hover {
        color: #fff;
        background-color: red;
    }
    /* set dropdown to default */
    #nav li:hover li a, #nav li.over li a, #nav li:hover li:hover li a, #nav li.over li.over li a, #nav li:hover li:hover li:hover li a, #nav li.over li.over li.over li a {
        color: #777;
        background: #fffccc;
    }
    #nav li ul li a {
        padding: 4px 5px;
    } /* Sub Menu Styles */
    ul#nav li:hover ul ul, ul#nav li:hover ul ul ul, ul#nav li.over ul ul, ul#nav li.over ul ul ul {
        margin-left:-999em;
    }
    ul#nav li:hover ul, ul#nav li li:hover ul, u#navl li li li:hover ul, ul#nav li.over ul, ul#nav li li.over ul, ul#nav li li li.over ul {
        margin-left:0;
    }
    </style>
    </head>
    <body>
    <ul id="nav">
        <li><a href="#">Home</a></li>
        <li><a href="#">About</a>
            <ul>
    
                <li><a href="#">History</a></li>
                <li><a href="#">Team</a></li>
                <li><a href="#">Offices</a></li>
            </ul>
        </li>
        <li><a href="#">Services</a>
            <ul>
    
                <li><a href="#">Web Design</a></li>
                <li><a href="#">Internet Marketing</a></li>
                <li><a href="#">testing ></a>
                    <ul>
                        <li><a href="#">test 1</a></li>
                        <li><a href="#">test 2</a></li>
    
                        <li><a href="#">test 3</a></li>
                        <li><a href="#">testing ></a>
                            <ul>
                                <li><a href="#">test 1</a></li>
                                <li><a href="#">test 2</a></li>
                                <li><a href="#">test 3</a></li>
    
                                <li><a href="#">test 4</a></li>
                                <li><a href="#">test 5</a></li>
                            </ul>
                        </li>
                        <li><a href="#">test 4</a></li>
                        <li><a href="#">test 5</a></li>
                    </ul>
    
                </li>
                <li><a href="#">Hosting</a></li>
                <li><a href="#">Domain Names</a></li>
                <li><a href="#">Broadband</a></li>
            </ul>
        </li>
        <li><a href="#">Contact Us</a>
    
            <ul>
                <li><a href="#">United Kingdom</a></li>
                <li><a href="#">France</a></li>
                <li><a href="#">USA</a></li>
                <li><a href="#">Australia</a></li>
            </ul>
        </li>
    
    </ul>
    </body>
    </html>

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
  •