SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    May 2004
    Location
    Avon
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Making area darker

    I'm looking to make a certain part darker using CSS. This was the code I was given:

    -moz-opacity:0.9;
    (for Mozilla/Netscape)

    But just makes it lighter. Negative numbers don't work. What do I do??

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

    The background of the element needs to be darker than the background you are contrasting against.

    e.g.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style type="text/css">
    #bg {
     width:400px;
     height:300px;
     background: red ;
     }
    #test {
     width: 300px;
     height:200px;
     margin: 0 50px;
     background-color: #CC0000;/*dark red*/
     filter:alpha(opacity=70);
     -moz-opacity:0.7;
     }
    </style>
    </head>
    <body>
    <div id="bg">
      <div id="test">
    	<p>Some text : Some text : some text<p>
      </div>
    </div>
    </body>
    </html>
    You realise that this will also make the text opaque as well.

    Heres a link to another thread about opacity that may help.

    http://www.sitepoint.com/forums/show...hlight=opacity

    Paul

  3. #3
    SitePoint Zealot
    Join Date
    May 2004
    Location
    Avon
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So I would be better off doing it in Photoshop?

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,389
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    For the time being yes - depending on what exactly you are doing of course


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
  •