Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15
  1. #1
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts

    Opera and CSS trouble

    Well, I finally got my site converted to valid XHTML and CSS... works fine in all browsers except for Opera. Here's a page:

    http://richardmedek.com/current/index.htm

    and here's the style sheet:

    http://richardmedek.com/style.css

    What's basically happening is the "menu" div is being offset by 5px, and the bottom border properties aren't being displayed. I moved it with a negative margin, but then the border props still don't show. All of the pages, including the home page, have the same layout, with the same problem (I'm assuming the 5px margin shift is happening on all divs because the home page doesn't have a "menu" div.

    There are no problems with IE or Moz, only Opera. My Javascript doesn't work, either, but that's different post

    So, any Opera fan with ideas?

    -Rich

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Opera has a list of what it supports (css wise) and is available at
    http://www.opera.com/docs/specs/#css

    that may explain why it doesn't look the same.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #3
    New Coder
    Join Date
    Dec 2003
    Location
    On your monitor
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't like Opera with their ads on the top of the browser.....

    - ZYPHER

  • #4
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Yeah, Zypher, I'm not too crazy about the banners, either, but they're a pretty small company and have to pay the bills, right? You could always get the registered version for a few bucks minus the banners...

    Scroots, thanks for the link... I checked it out but Opera seems to support everything I've got there and nothing I don't, so it's got to be from a different interpretation of the specs, right?

    Still appreciate any ideas anyone has...

    -Rich


    P.S. I did notice that Opera doesn't support the <script> tags in certain forms of XHTML. Is javascript supposed to be phased out or something?

  • #5
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    Not exactly, well as far as I know it's not. You can use javascript in xhtml 1.1 strict even. You have to have the type attribute I think -
    Code:
    <script type="text/javascript"> /* YOUR SCRIPT HERE */</script>
    Also to get your page right (which seems only to be the menu that's the prob) in opera use -
    Code:
    #menu ul li {
         padding: 0px;
    }
    Last edited by Mhtml; 12-26-2003 at 03:07 AM.
    Omnis mico antequam dominus Spookster!

  • #6
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Thanks Mhtml... you know, when I was debugging the CSS I made sure to throw "#menu ul {padding:0px}" in there and didn't think to use that for the list item, too. It turns out that Opera 7 on my Mac doesn't respond to the padding for the list, but the margin (i.e., #menu ul li {margin:0px}).

    As far as the <script> tag, I was just surprised when I read this on the Opera spec site:

    XHTML 1.1 support

    Opera version 7 supports XHTML 1.1 with these exceptions:

    * Event attributes are not supported for the option element
    * The table cell attributes char and charoff are not supported.
    * The bidirectional override element bdo and the dir attribute. The lang attribute is not supported.
    * The script element is not supported
    * Ruby annotations
    Maybe I'm misreading it, it just kind of threw me for a loop...

    -Rich

  • #7
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    Just whent and read all opera xhtml stuff I could find. Sure makes development harder in some cases with opera because it's supports less than I thought.

    It's supports ruby, I've never seen anyone actually use it though. I used it to test once but never seen it anywhere but in w3c demo.
    Omnis mico antequam dominus Spookster!

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Opera 7.2 doesn't support <script> in XHTML mode - so that's only when you're serving as application/xhtml+xml - if you're serving XHTML as HTML then it will still work as normal.

    However if you are serving as XHTML it's worth being aware of - personally, I sniff for Opera versions earlier than 7.3 and don't serve them XHTML, even if they accept it - http://www.codingforums.com/showthre...483#post157483 has an example of doing that in PHP.

    But it's only 7.2 that has this problem - 7.1 and earlier didn't support XHTML anyway, and in the forthcoming 7.5 scripting works as expected.

    btw - you can't be using Opera 7 for mac - there is no Opera 7 for mac.
    Last edited by brothercake; 12-28-2003 at 11:22 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #9
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    yeah, my bad, it's actually 6.03...

    so, this is because I'm mostly a hack at the programming thing, but could you briefly explain serving up XHTML as an XML or HTML application? (or recommend a resource...) This isn't something I'm too familiar with. Thanks for the help...

    -Rich

  • #10
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by rmedek
    so, this is because I'm mostly a hack at the programming thing, but could you briefly explain serving up XHTML as an XML or HTML application? (or recommend a resource...) This isn't something I'm too familiar with. Thanks for the help...

    -Rich
    Technically, you should include this MIME type in your header when coding in XHTML:
    Code:
    <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
    which is often called 'serving up' a page as a MIME type. The support for application/xhtml+xml isn't great with older browsers, but it shouldn't have a detrimental effect.
    Last edited by me'; 12-29-2003 at 10:07 AM.
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It will have a detrimental effect - if you serve as application/xhtml+xml IE will try to download the page instead of viewing it. What you have to do is get the server to find out what the browser accepts, and serve that.

    There are two ways of doing it that I know of - one is with .htaccess and the other is with PHP. This thread shows both options - How to serve XHTML as application/xhtml+xml

    I generally do it in PHP, and store a $mimeName variable as well, which can be used to write the content-type meta-tag:
    Code:
    //serve as HTML by default
    $mime = "html";
    
    //mime name used to write meta Content-Type element
    $mimeName = "text/html";
    	
    //set private cache control 
    header("Cache-Control: private");
    
    //if the UA accepts application/xhtml+xml
    if (
    	stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")
    	&&
    	(
    		//and it's either Opera 7.3 or greater
    		eregi("opera[ \/]7\.[^012]",$_SERVER["HTTP_USER_AGENT"])
    		||
    		//or not Opera at all
    		!eregi("opera",$_SERVER["HTTP_USER_AGENT"])
    		)
    	) 
    { 
    	//serve as XML
    	$mime = "xml"; 
    }
    
    //override var
    if(isset($_GET["mime"])) 
    { 
    	$mime = $_GET["mime"]; 
    }
    
    //if we're serving as XML
    if($mime == "xml")
    {
    	//content type header
    	header("Content-Type: application/xhtml+xml");
    	
    	//xml processing instruction
    	echo("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
    	
    	//set mime name
    	$mimeName = "application/xhtml+xml";
    }
    //if we're serving as HTML
    else
    {
    	//content type header
    	header("Content-Type: text/html");
    }
    Then
    Code:
    <meta http-equiv="Content-Type" content="<?php echo($mimeName); ?>; charset=ISO-8859-1" />
    NB - meta Content-Type headers are a last resort - they should reflect the content-type rather than setting it - document headers should do that.

    But of course the main question is why you'd want to do this at all, and that's a bit more difficult to explain.

    The bottom line is that XHTML is not text, it's nodes, and if you serve it as text you've serialised the document such that it isn't XML anymore. Whether that matters to you depends on what you;re doing - if you want to embed other XML applications, or you want to future-proof yourself by becoming familiar with scripting in the XML DOM, then it's worth doing. Or if you just wanna do it for the sake of it, because it is technically the correct way with XHTML, then that's fair as well. Or if you like the way it gets parsed - mozilla will not attempt to render malformed XHTML if it's served as XML, it'll throw a parsing exception and stop. Opera will attempt to render it, but it will print-out the source and show you the error as well.

    But it's like getting married - if you can't think of a good reason to do it, and you can think of a good reason not to, don't.
    Last edited by brothercake; 12-29-2003 at 04:17 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #12
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just one question &mdash why give the option to override the mime type with $_GET?
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

  • #13
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally it was a quick way of testing - if a method or proerty isn't working as expected, one thing to check is whether the DOM makes a difference.

    But I left it in for fun
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #14
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by brothercake
    But I left it in for fun
    lol, fair enough
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

  • #15
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    ahhh... slowly but surely XHTML and XML are beginning to make sense. Thanks for the help....

    -Rich


  •  

    Posting Permissions

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