Questions about CSS.

Discussion in 'General Webmaster Support' started by Exide, Sep 2, 2008.

  1. duyen

    duyen New Member

    Ratings:
    +214 / 0 / -0
    Tables are bad. The World Wide Web Consortium will come to your house with torches if you use tables for anything except displaying data.
     
  2. Exide

    Exide I am amazingly focused right now!

    Ratings:
    +449 / 0 / -0
    I'm guessing I should not include tables, then? :p

    Why won't my picture show all of the screen?

    See the black border on this picture. I want the picture to reach all of the screen. (No black border.)
    Like on this website:
    http://www.kineticshadows.com/ -The loggo is fit to the screen.

    Here's my code:
    Code:
    <body bgcolor="black">
    
    <div id="test">
    </div>
    
    Code:
    #test
    {
     width: 100%;          [COLOR="Red"]//I don't know if this works..[/COLOR]
     height: 300px;
     background-image: url(Images/loggo3.png);
    }
    
     
  3. duyen

    duyen New Member

    Ratings:
    +214 / 0 / -0
    That kinetic shadows site's logo only fits to the screen because it is a bunch of layered background images.

    Also comments in CSS are declared like this: /*Comment*/

    If you want to know how to repeat a background image click here.

    If you want to know how to repeat it only on 1 axis click here.
     
  4. Exide

    Exide I am amazingly focused right now!

    Ratings:
    +449 / 0 / -0
    I tried this:
    Code:
    <body background="Images/loggo3.png">
    
    -That removed the border.
    But I don't know what it with look like on other browsers and other resolutions..

    EDIT: Also, the background picture repeats itself..

    EDIT #2: I solved that by doing this:
    Code:
    </head>
    
    <style type="text/css">
    body 
    { 
     background-image: url(Images/loggo3.png);
     background-repeat: no-repeat;
    }
    </style>
    
    
    <body>
    
    Don't know what others will think of that solution, though.. :p

    >That kinetic shadows site's logo only fits to the screen because it is a bunch of layered background images.
    Do you know /could you show me/ how to do this? :)
     
  5. duyen

    duyen New Member

    Ratings:
    +214 / 0 / -0
    Well start with the bg:

    Code:
    body
    {
     background-image: blah; 
     background-repeat: no-repeat;
     [COLOR="Red"]/*Any other settings*/[/COLOR]
    }
    Then a div floating to the left:

    Code:
    #topleft
    {
     float: left;
     width: 200px; [COLOR="Red"]/*DO NOT SET THIS VALUE TO A %, SET IT TO THE IMAGE'S WIDTH!*/[/COLOR]
     background-image: blah;
     background-repeat: no-repeat;
     [COLOR="Red"]/*Any other settings*/[/COLOR]
    }
    Then a div floating to the right:
    Code:
    #topright
    {
     float: right;
     width: 200px; [COLOR="Red"]/*DO NOT SET THIS VALUE TO A %, SET IT TO THE IMAGE'S WIDTH!*/[/COLOR]
     background-image: blah;
     background-repeat: no-repeat;
     [COLOR="Red"]/*Any other settings*/[/COLOR]
    }
    You get the drift right?
     
  6. Exide

    Exide I am amazingly focused right now!

    Ratings:
    +449 / 0 / -0
    Thanks.

    Here's what it looks like now:

    [​IMG]

    I was wondering how to set a background where those red arrows are pointing. (The black part of the screen.)
    Also, here's the code:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Work Factory</title>
    
    <link href="divs.css" rel="stylesheet" type="text/css">
    </head>
    
    <style type="text/css">
    body 
    { 
     background-image: url(Images/loggo3.png);
     background-repeat: no-repeat;
    }
    </style>
    
    
    <body bgcolor="#000000">
    
    <div id="top">  </div>
    
    <div id="container">
    
    <div id="buttons"> Buttons </div>
    
    <div id="center">
    
    <br>
    <iframe src="firstpage.html" name="center" width="80%" height="95%" marginwidth="10" marginheight="10" 
    
    scrolling="auto" frameborder="0" allowtransparency="true">
    </iframe>
    
    
    </div>
    </div>
    
    
    </body>
    </html>
    
    Code:
    #container 
    {
     width: 80%;
     margin: 2em 110px;
    }
    
    #top
    {
     height: 265px;
    }
    
    #center
    {
     height: 40em;
     text-align: center;
     background: #ABC999;
     opacity: 1; filter: alpha(opacity=100);
    }
    
    #buttons
    {
     text-align: center;
     height: 4em;
     background: #999ABC;
    }
    
    -Would it matter much if the code is crap, but what people see looks ok?


    EDIT:
    Another question.

    I want to use a menu for buttons, that opens the link in an iframe.
    But these buttons changes colors, depending what side/link I am watching.

    Here's the code:
    Code:
    <div id="menycontainer">
     <ul>
      <li><a href="firstpage.html" id="current">Meny 1</a></li>
      <li><a href="secondpage.html">Meny 2</a></li>
      <li><a href="firstpage.html" target="center">Meny 3</a></li>
      <li><a href="secondpage.html" target="center">Meny 4</a></li>
      <li><a href="firstpage.html" target="center">Meny 5</a></li>
     </ul>
    </div>
    
    id="current" sets what page you are on.

    Code:
    #menycontainer ul{margin-left: 0; padding-left: 0; float: left;	font: 70% Verdana, Helvetica, sans-serif;}
    #menycontainer li{display: inline;}
    
    #menycontainer ul a{float: left; background: #CC9999; text-decoration: none; margin-right: 0.5em; padding: 0.3em 
    
    2em;}
    
    
    #menycontainer a:link{color: #ffffff;}
    
    #menycontainer a:visited{color: #ffffff;}
    
    #menycontainer a:hover{background: #996666;}
    
    #menycontainer a#current{background: #FFCC66; color: #000000;}
    
    What happens is that I either have to change the whole page (and create 5 different pages).
    Or use the iframe and the color won't work.

    I want to use iframe with working colors. :p
     
  7. duyen

    duyen New Member

    Ratings:
    +214 / 0 / -0
    >I was wondering how to set a background where those red arrows are pointing. (The black part of the screen.)
    Also, here's the code:


    Use float: left; and float: right; - Then repeat the background on the Y axis?

    >I want to use a menu for buttons, that opens the link in an iframe.
    But these buttons changes colors, depending what side/link I am watching.


    You might need to add some JavaScript if your saying they're all dislayed on the same page - I can point you in the right direction if that's what you want.
     
  8. Exide

    Exide I am amazingly focused right now!

    Ratings:
    +449 / 0 / -0
    1. Nah, the picture on the top is already the background. -I don't think I can have two backgrounds.

    2. Here's an example: (Which I'm using.)
    http://www.webdesignskolan.com/css-meny/exempel/menyexempel7/sida1.htm
    -The thing about that is that each click updates the entire site. I just want to update the iframe and the buttons, if possible.
     
  9. duyen

    duyen New Member

    Ratings:
    +214 / 0 / -0
    >Nah, the picture on the top is already the background. -I don't think I can have two backgrounds.

    Yes you can - but no on the body.

    >Here's an example: (Which I'm using.)
    http://www.webdesignskolan.com/css-m...pel7/sida1.htm
    -The thing about that is that each click updates the entire site. I just want to update the iframe and the buttons, if possible.


    That changes the web page - and dosen't even use iframes.

    But if you want to know how to do that you might want to look at my code for the buttons at http://www.rodead.com/rodead_forum/gamehall/

    But as I was saying - to do that you would need to use JavaScript.
     
  10. Exide

    Exide I am amazingly focused right now!

    Ratings:
    +449 / 0 / -0
    >Yes you can - but no on the body.
    How? =)

    >But if you want to know how to do that you might want to look at my code for the buttons at
    Yea, that's how I want it.
    I'd love to get some help on that. :)
     
  11. duyen

    duyen New Member

    Ratings:
    +214 / 0 / -0
    >How? =)

    Make a div over the background - then set the div's background-image to something else. Ta-da! 2 bg's.

    >Yea, that's how I want it.
    I'd love to get some help on that. :)


    I'll getcha a script just hold on.

    EDIT:

    Alright - didn't get to test:

    Put this in the head section:
    Code:
    <script type="text/javascript">
    var page(p)
    function setpage(p)
    {
    page=p;
    switch (page)
     {
     case 1:
       document.write('<iframe src="firstpage.html" id="current" name="center" width="80%" height="95%" marginwidth="10" marginheight="10"');
       break;
     case 2:
       document.write('<iframe src="secondpage.html" id="current" name="center" width="80%" height="95%" marginwidth="10" marginheight="10"');
       break;
     case 3:
       document.write('<iframe src="thirdpage.html" id="current" name="center" width="80%" height="95%" marginwidth="10" marginheight="10"');
       break;
     }
    }
    </script>
    Then where your buttons are:

    Code:
    <img src="firstbutton.png" onclick="setpage(1)">
    <img src="secondbutton.png" onclick="setpage(2)">
    Something like that.
     
  12. Exide

    Exide I am amazingly focused right now!

    Ratings:
    +449 / 0 / -0
    Thanks.
    But is it possible to change the color, not using pictures? (Like in the example code that I was using.)
     
  13. enouwee

    enouwee Non ex transverso sed deorsum

    Ratings:
    +235 / 0 / -0
  14. Exide

    Exide I am amazingly focused right now!

    Ratings:
    +449 / 0 / -0
    EDIT:
    I've decided to use pictures for buttons/links..

    So now is that link you gave me, enouwee, a really cool option.
    However, I can't get it to work. :( (Surprise!)

    So here's what I did:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO 8859-1">
    <title> </title>
    
    <link rel="shortcut icon" href="images/favicon.ico">
    <link href="divs.css" rel="stylesheet" type="text/css">
    
    <style type="text/css">
    
    	#examplenav {
    		margin: 0;
    		padding: 0;
    	}
    	#examplenav li {
    		list-style: none;
    		height: 35px;
    		float: left;
    		position: relative;
    	}
    	#examplenav li a {
    		height: 35px;
    		text-indent: -9000px;
    		display: block;
    	}
    	#examplenav .current a { background-position: 0 -24px; }
    	
    	a#home,
    	a#about,
    	a#products,
    	a#contact {
    		width: 80px;
    		height: 35px;
    	}
    	
    	a#cities { background-image: url(images\button_home.png); }
    	a#about { background-image: url(images/button_about.jpg); }
    	a#contact { background-image: url(images/button_contact.jpg); }
    	a#products { background-image: url(images/button_products.jpg); }
    		
    	a#home:hover,
    	a#about:hover,
    	a#contact:hover,
    	a#products:hover
    	{ background-position: 0 -35px; }
    
    </style>
    
    </head>
    
    <style type="text/css">
    body 
    { 
     background-image: url(images/loggo4.png);
     background-repeat: no-repeat;
     background-color: #000000;
    }
    </style>
    
    
    <body>
    
    <div id="top"> </div>
    
     <div id="container">
    
     <div id="center">
    
      <div id="buttons">
    
    
    <div id="examplenavcontainer">
    <ul id="examplenav">
    
    <li title="Cities"> <a href="#" id="Cities"> Test </a> </li>
    
    <li title="About" class="current"> <a href="#" id="about"> About </a> </li>
    <li title="Products"> <a href="#" id="products"> Products </a> </li>
    <li title="Contact"> <a href="#" id="contact"> Contact </a> </li>
    </ul>
    </div>
    
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>        [COLOR="red"]/* I don't know what this means */[/COLOR]
    <script type="text/javascript">_uacct = "UA-901918-6";urchinTracker();</script>                  [COLOR="Red"]/* I don't know what this means */[/COLOR]
          
    
      </div>
    
      <br>
       <iframe src="iframe.html" name="iframe" width="85%" height="95%" marginwidth="10" marginheight="10"     scrolling="auto" frameborder="0" allowtransparency="true">
       </iframe>
     </div>
    </div>
    
    
    </body>
    </html>
    

    Most of the code is copied and pasted from that example (just to see if it would work at all). Sadly it didn't. :p
    Um.. Help, please? :)
     
  15. UndeadDragon

    UndeadDragon Super Moderator Staff Member

    Ratings:
    +450 / 0 / -0
    Code:
    	a#cities { background-image: url(images\button_home.png); }
    
    should be

    Code:
    	a#cities { background-image: url(images[B]/[/B]button_home.png); }
    
     
    • Like Like x 1
  16. Exide

    Exide I am amazingly focused right now!

    Ratings:
    +449 / 0 / -0
    Thanks, UndeadDragon. :)
    New problem occured, though!

    I can see half the picture (probably 'width' that is messing up somewhere..) in Google Chrome, but not in Internet Explorer.. :confused:
    I'd like to see the whole picture in both browsers. :p
     
  17. duyen

    duyen New Member

    Ratings:
    +214 / 0 / -0
    Chrome is fail fail since it's only been out so long.

    Use FF, Opera or SeaMonkey.
     
  18. Exide

    Exide I am amazingly focused right now!

    Ratings:
    +449 / 0 / -0
    OFFTOPIC: Chrome worked better than Internet Explorer.
    I rather drink battery acid, than installing any of those on my computer. :rolleyes:

    Any clues on what part of the code could be messing up my website?
    -On that example website (from where I stole the code) it worked on IE.

    EDIT: I managed to fix it! =)
    Currently I have no further questions. (Don't worry, there will be more before I'm done!)
    I know I will have questions about resolutions and using different browsers to view the website in the future.. So you might want to read up on that! :p
     
  19. duyen

    duyen New Member

    Ratings:
    +214 / 0 / -0
    I don't read up on anything you asked so far lol :p

    Got half this shit memorized.
     
  20. Exide

    Exide I am amazingly focused right now!

    Ratings:
    +449 / 0 / -0
    That's rude, dude! :thup:

    Ok, new question. :p
    I almost got my meny's to work!
    I'm tired, it's 1am here and I'm going to bed after asking this question, so it's probably me just missing some 'width: *;' in the code somewhere..
    I figure I'd just ask anyway..

    So I got five buttons now (just to test with, they all look the same anyway), which links to different pages (some aren't created yet, but nevermind..)
    The problem is that the first button called 'cities' shows only about 20%, then it's "overlapped" (is that a word?) by the second button. (Meaning the first button is only partly visible. -All the other buttons looks fine, though..)

    Here's the code: (I put the CSS in a .css file, for cleaner code.)

    Code:
    <body>
    
    <div id="top"> </div>
    
     <div id="container">
    
     <div id="center">
    
      <div id="buttons">
    
       <div id="menycontainer">
        <ul id="meny">
    
         <li title="cities"> <a href="iframe.html" target="iframe" id="cities"> Test </a> </li>
         <li title="About" class="current"> <a href="firstpage.html" target="iframe" id="about"> About </a> </li>
         <li title="Products"> <a href="#" target="iframe" id="products"> Products </a> </li>
         <li title="Contact"> <a href="#" target="iframe" id="contact"> Contact </a> </li>
    
        </ul>
       </div>
      </div>
    
     <br>
     <iframe src="iframe.html" name="iframe" width="85%" height="95%" marginwidth="10" marginheight="10"     
    
    scrolling="auto" frameborder="0" allowtransparency="true">
     </iframe>
    
     </div>
    </div>
    
    </body>
    </html>
    
    Code:
    #meny 
    {
     margin-left: 40%;
     padding: 0;
    }
    
    #meny li 
    {
     list-style: none;
     height: 35px;
     float: left;
     position: relative;
    }
    
    #meny li a 
    {
     height: 35px;
     text-indent: -9000px;
     display: block;
    }
    
    #meny .current a{ background-position: 0 -70px; }
    	
     a#home,
     a#about,
     a#products,
     a#contact 
    {
     width: 80px;
     height: 35px;
    }
    	
     a#cities { background-image: url(images/button_cities2.png); }
     a#about { background-image: url(images/button_cities2.png); }
     a#contact { background-image: url(images/button_cities2.png); }
     a#products { background-image: url(images/button_cities2.png); }
    		
     a#home:hover,
     a#about:hover,
     a#contact:hover,
     a#products:hover
    { background-position: 0 -35px; }
    
    As you can see, I'm using the same picture on all the buttons, but that's just for testing purposes..

    Hope you can find the error for me. <3
    Good night. :p
     

Share This Page