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 8 of 8
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Canada
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up I need a few CSS "parameters"

    Simple question, my thanks to whoever can help me out first.

    I was just wondering how I'd declare the following in a CSS file: (ie. *.css)

    - body: background color
    - body margins: marginwidth, marginheight, leftmargin, rightmargin, topmargin, bottommargin
    - body: text, link, vlink, alink

    The answer is probably staring me in the face. :P Any and all help is appreciated.
    Tombo out.

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    body{

    background-color:#FF0000
    margin-top:10
    margin-right:10
    margin-bottom:10
    margin-left:10
    color:#0000FF
    }

    a{
    color:#000000;
    text-decoration:none
    }

    a:hover{
    color:#00FF00
    }

    a:active{
    color:#FF0000
    }

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Location
    Bristol, UK
    Posts
    932
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    body {
    	background-color: #00CCFF;
    	margin: 0px;
    	padding: 0px;
    	margin-left: 0px;
    	/* apply the same to right, top and bottom for both margin and padding, e.g. 		padding-top: 0px; OR else do this: */
    	margin: 0px 0px 0px 0px;
    	padding: 0px 0px 0px 0px;
    	/* where it goes t r b l like a clock (12 3 6 9) */
    }
    
    p {
    	font-family:		Tahoma, Verdana, Arial, sans-serif;
    	font-size:		10px;
    	font-weight:		bold;
    	font-style:		italic;
    	color: #000000;
    	background-color: #EEEEEE;
    }
    
    a:link {
    	color: #330099;
    	text-decoration: underline;
    }
    a:visited {
    	color: #660099;
    	text-decoration: underline;
    }
    a:hover {
    	color: #0066FF;
    	text-decoration: underline;
    }
    a:active {
    	color: #330099;
    	text-decoration: underline;
    }
    Plenty more too, look here:

    http://www.devguru.com/Technologies/...css_index.html

    ::] krycek [::
    ithium | SOAPI | SDP | PTPScript manual
    "ithium is a non-profit webhost, which is pretty much unique. The mission of ithium is to provide free hosting resources for worthwhile and needy non-profit projects, which otherwise may not be able to obtain such facilities. The money from commercial customers goes to maintain ithium's servers and further development."

  • #4
    New Coder
    Join Date
    Jun 2002
    Location
    Canada
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks :)

    Muchos gracias seniors

    Pardon my French.
    Tombo out.

  • #5
    New Coder
    Join Date
    Jun 2002
    Location
    Canada
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What about...

    Okay, hold on... another quick question. (Thanks for the link BTW, and I really like the quote.)

    I have this:

    .title {
    font-weight: bold;
    color: #344B5A;
    }

    It's a pre-defined <div></div> tag, for titles on my pages. I also have table cells with a certain background color. What I'd like to know...

    <td width="100%" align="center" bgcolor="#BCC3C2">

    Can I make the actual bgcolor color a variable I'd declare in my CSS file? For example:

    CSS =

    cellcolor {
    color: #000000
    }

    HTML =

    <td width="100%" align="center" bgcolor="cellcolor">

    Make sense? (I don't want all cells to change color, just the one's I select... and I want that color to be declared in my CSS file. I was hoping to configure 2 colors, BTW.)

    And again, you guys are the best.
    Tombo out.

  • #6
    Regular Coder
    Join Date
    Nov 2002
    Location
    Bristol, UK
    Posts
    932
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes, you can... in two ways.

    first, you can do it by using a server-side language such as PHP to insert the value you want, so that isn't gonna be exactly what you are after, I think.

    second, you can create two or more classes that you can apply dynamically, e.g. swap them with JS. But, for that matter, you can swap them anyway, so you may not want to do it with class swapping unless you have more than one property to swap at once.

    so for what you were asking, no, but yes it can be done, just a different way.

    if you need scripts for the above, just choose you method and shout

    ::] krycek [::
    ithium | SOAPI | SDP | PTPScript manual
    "ithium is a non-profit webhost, which is pretty much unique. The mission of ithium is to provide free hosting resources for worthwhile and needy non-profit projects, which otherwise may not be able to obtain such facilities. The money from commercial customers goes to maintain ithium's servers and further development."

  • #7
    New Coder
    Join Date
    Jun 2002
    Location
    Canada
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Well

    Since PHP isn't an option, I'd have to go with #2.
    Tombo out.

  • #8
    Regular Coder
    Join Date
    Nov 2002
    Location
    Bristol, UK
    Posts
    932
    Thanks
    0
    Thanked 0 Times in 0 Posts
    okiedokie, well if you want to swap classes, then this script should do it:

    Code:
    function setClassName(element, className){
    	document.getElementById(element).className= className;
    }
    So, you basically setup something that just toggles the classes. For instance, if you want them to change when the mouse moves over, attach the function to the onMouseOver event.

    Note that you have to pass a string to the element parameter, rather than an object reference.

    ::] krycek [::
    ithium | SOAPI | SDP | PTPScript manual
    "ithium is a non-profit webhost, which is pretty much unique. The mission of ithium is to provide free hosting resources for worthwhile and needy non-profit projects, which otherwise may not be able to obtain such facilities. The money from commercial customers goes to maintain ithium's servers and further development."


  •  

    Posting Permissions

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