#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    10
    Rep Power
    0

    css linkstyle rendering problem in safari


    I have produced some linkstyles in dreamweaver mx using css properties of a:link, a:hover etc.

    I want my links to have a background box which changes colour when the link is rolled over.

    The code I have produced (see below) works perfectly in IE 5.2 on the mac but in safari the box height and width parameters are seemingly ignored so any background colour/border properties only affect the area directly behind the text and are not applied to the box as they should be.

    Anyone know how to get this working in safari?

    thanks
    bob

    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    a:link {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #003366;
    text-align: left;
    height: 20px;
    width: 200px;
    border-top-width: 1px;
    border-top-style: solid;
    border-top-color: #FFFFFF;
    text-decoration: none;
    margin: 0px;
    text-indent: 15px;
    vertical-align: middle;
    line-height: 20px;
    background-color: #EAEEEE;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: #CCCCCC;
    }
    a:visited {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #003366;
    text-align: left;
    height: 20px;
    width: 200px;
    border-top-width: 1px;
    border-top-style: solid;
    border-top-color: #FFFFFF;
    text-decoration: none;
    margin: 0px;
    text-indent: 15px;
    vertical-align: middle;
    line-height: 20px;
    background-color: #EAEEEE;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: #CCCCCC;
    }
    a:hover {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #003366;
    text-align: left;
    height: 20px;
    width: 200px;
    border-top-width: 1px;
    border-top-style: solid;
    border-top-color: #FFFFFF;
    text-decoration: none;
    margin: 0px;
    text-indent: 15px;
    vertical-align: middle;
    line-height: 20px;
    background-color: #B8D6FF;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: #CCCCCC;
    }
    -->
    </style>
    </head>

    <body leftmargin="0" topmargin="0">
    <p><a href="link1">link to me now</a><br>
    <a href="link2">ok i'm a link</a><br>
    <a href="link3">you guessed it</a><br>
    <a href="link4">someone say link</a><br>
    </p>
    </body>
    </html>
    Attached Files
  2. #2
  3. |<.+#f@#+.&.|
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2002
    Location
    norway
    Posts
    3,009
    Rep Power
    1224
    safari does the right thing,
    width and height assigned to an inline element should be ignored.

    use display:block; to make the anchor elements to act like blocklevel elements.


    a:link {
    display:block;


    note instead of
    border-top-width: 1px;
    border-top-style: solid;
    border-top-color: #FFFFFF;

    you could write
    border-top:1px solid #ffffff;
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    10
    Rep Power
    0
    Hi Akh

    Thanks for that. I've never come across inline and block level elements. Can you tell me where I can find out about them.

    I added the

    a:link {
    display:block;

    as you suggested. Safari now sees the box. success!

    BUT... a space has now appeared between each link that wasn't there before. There should be no spaces between my link boxes and I don't know whats causing it

    Any ideas?
    thanks again
    spirit
  6. #4
  7. |<.+#f@#+.&.|
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2002
    Location
    norway
    Posts
    3,009
    Rep Power
    1224
    Last edited by Akh; December 4th, 2003 at 09:02 PM.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    10
    Rep Power
    0

    Smile


    Thnks Akh

    you've made my day!

    bob

IMN logo majestic logo threadwatch logo seochat tools logo