Quantcast

What works and what is paused · Email is limited to account activation and password resets.

Jump to content


Photo

CSS Help


  • Please log in to reply
28 replies to this topic

#1 Crayon

Crayon
  • 913 posts

Posted 18 November 2010 - 11:20 PM

Edit: According from my last post, Fetish fixed my drop down menu problem and all other problems listed. I've been trying for two days now trying to duplicate the drop down menu so the 'rules' button is a drop down as well. Every time I attempt this, either the buttons after the 'rules' go below it, or the 'rules' button goes out of place. Any suggestion? All help is appreciated - Willing to pay in neopoints if needed :)











________________________________________________
Hi Guys,

I'm having trouble constructing my websites front page. The buttons 'home' and 'forums' move to different places on various screen resolutions. I'm using the position "absolute". The page should look like this on every screen:

Posted Image

My website "r-gaming.net/urban-rp" if you want to see the site itself.

If anyone expierenced in CSS can give me a hand it'll be appreciated.

here is the coding to this index file:

Spoiler


All help is appreciated. Thanks

Edited by Crayon, 23 November 2010 - 10:10 PM.


Advertisement

    #2 Noitidart

    Noitidart
    • Neocodex Co-Founder

    • 23214 posts


    Users Awards

    Posted 19 November 2010 - 12:58 AM

    Hm I see the problem. Let me work on it, looks tricky. I'll get back to you.

    #3 phr0sty

    phr0sty
    • 105 posts

    Posted 19 November 2010 - 06:41 AM

    there are several easy ways to center your content using css

    the best way is
    .element {
      display: block;
      margin: 0 auto; 
    }
    
    but it will only work if you set a doc type of XHTML 1 or higher (i believe)

    if you can't do that, a trusted css trick i learned (on myspace no less), should do the trick for you. the only caveat is that you need to know the width of your container
    .element {
      position: absolute;
      display: block;
      width: 500px;
      left: 50%;
      margin-left: -250px;
    }
    

    let me know if that helps :)

    #4 Crayon

    Crayon
    • 913 posts

    Posted 19 November 2010 - 03:19 PM

    Thanks for the replies guys :) I'll be waiting for an answer from you noit if this doesn't solve it xD thanks!


    there are several easy ways to center your content using css

    the best way is

    .element {
      display: block;
      margin: 0 auto; 
    }
    
    but it will only work if you set a doc type of XHTML 1 or higher (i believe)

    if you can't do that, a trusted css trick i learned (on myspace no less), should do the trick for you. the only caveat is that you need to know the width of your container
    .element {
      position: absolute;
      display: block;
      width: 500px;
      left: 50%;
      margin-left: -250px;
    }
    

    let me know if that helps :)


    Im not exactly sure if I understand this, but I'll read it a couple more times and see what I can come up with. if you can give me advice over MSN, my e-mail is [email protected]

    Thanks!

    #5 artificial

    artificial
    • 186 posts


    Users Awards

    Posted 19 November 2010 - 03:28 PM

    Fixed: http://ajberri.com/files/urban.zip

    Can't be bothered typing up what you did wrong, but if you have any specific questions I'll answer them.

    #6 Crayon

    Crayon
    • 913 posts

    Posted 19 November 2010 - 03:29 PM

    Thanks a bunch Artifeetfetish! Life saver dude. No problem, I'll just look into the code and compare it to my old scripting.

    #7 Noitidart

    Noitidart
    • Neocodex Co-Founder

    • 23214 posts


    Users Awards

    Posted 19 November 2010 - 10:50 PM

    Wow amazing work there chaos and xth!

    #8 Random

    Random
    • 8199 posts


    Users Awards

    Posted 20 November 2010 - 08:42 AM

    Fixed: http://ajberri.com/files/urban.zip

    Can't be bothered typing up what you did wrong, but if you have any specific questions I'll answer them.


    I love your site's logo :p

    #9 Crayon

    Crayon
    • 913 posts

    Posted 20 November 2010 - 10:24 AM

    Thanks! :) Now I have another bug with a similar situation >_> Darnit.

    #10 phr0sty

    phr0sty
    • 105 posts

    Posted 20 November 2010 - 10:42 AM

    Thanks! :) Now I have another bug with a similar situation >_> Darnit.


    what is the issue?

    #11 Crayon

    Crayon
    • 913 posts

    Posted 20 November 2010 - 11:02 AM

    Well if you click 'home' on the front page you'll end up here. http://www.r-gaming..../home/index.php

    I tried making the 'Other' button a drop down menu. I copied a code from another website and customized it to my liking, which worked great. (I'm still new to PHP/CSS coding, so yeah it's a noob method, lol.)

    Anyways, now I wanted to position the 'Other' button onto the navigation bar, but I can't center everything on it because its missing a button so it shifts all the buttons a bit to the left to center the ones already on there, and if I position the drop down "Other" button, it'll only go on top. What I did was add an image to the navbar "Other.png" so it centers everything, and then I moved the 'Other" button with the drop down on top of that. Problem is on larger screens you can see the buttons overlapping because they have a larger screen than mine. It should look like this:
    Posted Image


    Here is a snippet of that section for theme.php

    <td align="center" class="Estilo4"> <a href="/urban-rp/home/index.php"></centre><img src="/urban-rp/home/img/news.png" /></centre></a>  <a href="/forums/forum.php"><img src="img/forums.png"/></a><a href="http://www.r-gaming.net/urban-rp/home/donation.php"><img src="img/donate.png"/></a><a href="http://www.r-gaming.net/urban-rp/home/rules.php"><img src="img/rules.png"/></a><a href="http://www.r-gaming.net/urban-rp/home/controlpanel.php"><img src="img/UCP.png"/></a><a href="http://www.r-gaming.net/urban-rp/home/skins/skins.php"><img src="img/skins.png"/><img src="img/Other.png"/></a>
    
    <body class="css" onLoad="highlightCurrentMenuItem()">
    <div class="mainmenu" id="mainmenu">
        <div class="menu">
    	    <div><img src="img/Other.png"/>
                <div class="popup">
    	    	<a href="index.html">Staff Members</a>
    	    	<a href="#">About Us</a>
    	    	</div>
    

    Here's the snippet for the style.css

    <style type="text/css">
    
    body { font-family: Verdana; }
    
    div.mainmenu {
        position: absolute;
        left: 932px;
        top: 188px;
        font-weight: italic;
        z-index: 1;
    }
    
    div.menu {
        float: left;
        margin-left: 10px; 
    }
    
    div.popup a:hover { background-color: #FFFFFF; }
    div.menu:hover div:first-child { border-bottom: none; }
    div.menu div.popup { display: none; }
    div.menu:hover div.popup { 
        display: block; 
        background-color: #333333; 
    }
    
    
    div.menu div {
        width: 85px;
        background-color: #33333;
        padding: 5px;
        border: none;
    }
    
    
    div.popup div, div.popup a { display:block; text-decoration: none; margin: 2px 2px 2px 5px; }
    div.popup div + div, div.popup a + a { margin-top: 10px; } 
    
    div.content {
        position: absolute;
        left: 20px;
        top: 195px;
        border: 1px dashed gray;
    }
    
    .current:after { content: "<"; color: white; }
    .current:before { content: ">"; color: white; }
    .current { color: white; }
    </style>
    

    All help is appreciated, and Im willing to pay in neopoints if needed! :)

    Edit - I tried adding that #wrapper thing just like the previous problem, but it just makes things worse. Possibly because I did it wrong :/

    Edited by Crayon, 20 November 2010 - 11:03 AM.


    #12 Crayon

    Crayon
    • 913 posts

    Posted 20 November 2010 - 11:02 AM

    Double post~

    Edited by Crayon, 20 November 2010 - 11:02 AM.


    #13 phr0sty

    phr0sty
    • 105 posts

    Posted 20 November 2010 - 01:17 PM

    why don't you just use a list menu...
    http://www.456bereas...navigation_bar/ (skip straight to step 11 if you don't want to read).

    if you need help setting it up to use images, reply back to this thread...

    #14 Crayon

    Crayon
    • 913 posts

    Posted 20 November 2010 - 02:33 PM

    Alright when I get back from work I'll give it a try. Will be back in 4-5 hours. Thanks Chaos!

    Edit: Sorry I don't understand what the list menu does.

    http://www.456bereas..._navbar/step11/

    Isn't there suppose to be a drop down box? O_o (I'd prefer to have a drop down menu like the one I have right now :p)

    Edited by Crayon, 20 November 2010 - 02:35 PM.


    #15 artificial

    artificial
    • 186 posts


    Users Awards

    Posted 21 November 2010 - 12:28 AM

    Well the fix isn't very pretty, but then again neither was the coding. :thumbsup:

    Step 1 - Find:
    <style type="text/css">
    @import "style.css";
    </style>
    Replace with: (or alternatively, put the new CSS at the bottom of your stylesheet)
    <style type="text/css">
    @import "style.css";
    
    .Estilo4 a img {
    	border: 0 none;
    }
    .Estilo4 a {
    	display: block;
    	float: left;
    	margin: 5px 0 0 8px;
    }
    div.mainmenu {
    	position: relative !important;
    	float: left;
    	left: auto;
    	top: auto;
    	margin-left: -8px;
    }
    div.mainmenu a {
    	float: none;
    }
    div.popup {
    	position: absolute;
    }
    </style>

    Step 2 - Find:
    <body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
    Replace with:
    <body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" class="css" onLoad="highlightCurrentMenuItem()">

    Step 3 - Find:
    <body class="css" onLoad="highlightCurrentMenuItem()">
    Replace with:
    <!-- PHALLUS !-->

    Step 4
    - Find:
    <a href="http://www.r-gaming.net/urban-rp/home/skins/skins.php"><img src="img/skins.png"/><img src="img/Other.png"/></a>
    Replace with:
    <a href="http://www.r-gaming.net/urban-rp/home/skins/skins.php"><img src="http://r-gaming.net/urban-rp/home/img/skins.png"/></a>

    And ta'da. Should work fine.

    #16 Crayon

    Crayon
    • 913 posts

    Posted 21 November 2010 - 12:32 AM

    Thanks so much man :) PM me if you want a payment~ I'll test this out after Im done homework, or do it tomorrow morning

    #17 iomega

    iomega
    • 1070 posts


    Users Awards

    Posted 21 November 2010 - 12:47 AM

    <!-- PHALLUS !-->


    ?

    Edited by iomega, 21 November 2010 - 12:49 AM.


    #18 Crayon

    Crayon
    • 913 posts

    Posted 21 November 2010 - 01:02 AM

    Lol, I just googled "<!-- PHALLUS !-->" and it came up about shapes of penises. Weird..

    #19 iomega

    iomega
    • 1070 posts


    Users Awards

    Posted 21 November 2010 - 01:09 AM

    haha that's what caused my confusion.
    phallus is another term for penis :p

    #20 phr0sty

    phr0sty
    • 105 posts

    Posted 21 November 2010 - 06:48 AM

    lmao. i was thinking the same thing. phallus is not a programming term :p

    #21 Crayon

    Crayon
    • 913 posts

    Posted 21 November 2010 - 12:46 PM

    Probably a prank ;o

    #22 Warlord.

    Warlord.
    • 98 posts

    Posted 21 November 2010 - 04:46 PM

    The <!-- --!> tags denote a comment. (No effect on the page)

    A funny joke :)

    Edited by Warlord., 21 November 2010 - 04:47 PM.


    #23 Crayon

    Crayon
    • 913 posts

    Posted 21 November 2010 - 08:26 PM

    It got me :p

    Edit: I just edited the coding, and it works like a charm! Thanks Fetish :D

    I have a few questions:

    Whats 'Estilo4'

    Why do you have !important on: "position: relative !important;" Whats it mean?




    _________________

    EDIT 2:

    Can someone show me how to duplicate the dropdown menu so I can use it for other buttons such as 'Rules' please? :p I tried dupicating it and everything worked, but when I tried adding the first option in the drop down, it didnt enter the drop down box, it just went beside the rules button. If anyone cna lead me in the right direction, again, without penises, that would be great

    Edited by Crayon, 22 November 2010 - 11:13 PM.


    #24 ShadowKissed

    ShadowKissed
    • 3 posts

    Posted 24 November 2010 - 07:52 PM

    Free bump for your board. :p

    #25 Crayon

    Crayon
    • 913 posts

    Posted 24 November 2010 - 08:04 PM

    Thanks dude, lol. Anyone able to help? :o


    0 user(s) are reading this topic

    0 members, 0 guests, 0 anonymous users