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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 23

Thread: float:left;

  1. #1
    New Coder
    Join Date
    Jan 2011
    Location
    Slovenia
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts

    float:left;

    Hello

    The problem can be viewed here: www.zixoo.net

    the home, register, etc... links should float right from the logo, but instead they are on the right but they are kinda under the logo (I want them in the middle inline in the gray area). why doesn't it work like that? I used for example:
    #home {
    float:right
    }

    well, another problem is (but can't be viewed here) that the header itself is actually the body (as in <body class="body">) and not a div, because when it's a div it doesn't have 100% width and it also has some space empty on the top. I'm trying to fix that for a couple of days now, because as you see the page ain't much yet.

    here's some html:
    Code:
    <body class='body'>
    	<div id='index_top'>
    	<ul id='logo'>
    		<li><a href='index.php' class='logo'></a></li>
    	</ul>
    	</div>
    <br />
    ...blablabla...
    and here's some CSS:
    Code:
    html, body{
    font-family:arial;
    }
    a {
    text-decoration:none;
    list-style-image:none;
     -moz-outline-style: none; 
     outline: none; 
    }
    ul {
    list-style-type:none;
    }
    *:focus {
    outline:none;
    }
    /* Header */
    	#header {
    	height:10%;
    	}
    	#home {
    	float:right;
    	}
    	#profile {
    	float:right;
    	}
    	#msgs {
    	float:right;
    	}
    	#notifs {
    	float:right;
    	}
    	#buds {
    	float:right;
    	}
    	#shared {
    	float:right;
    	}
    /* End of Header */
    /* Left */
    	#left {
    	float:left;
    	border:1px solid black;
    	width:15%;
    	top:0;
    	left:0;
    	right:0;
    	bottom:0;
    	}
    /* End of Left */
    /* Content */
    	#content {
    	border:1px solid black;
    	width:70%;
    	margin-right:15%;
    	margin-left:auto;	}
    /* End of Content */
    /* Right */
    	#right {
    	float:right;
    	width:15%;
    	border:1px solid black;
    	position:fixed;
    		}
    /* End of Right */
    /* Index Login */
    	#formindex {
    	padding-top:30px;
    	}
    	#indexmenu {
    	float:right;
    	}
    	.name {
    	height:28px;
    	padding-left:5px;
    	padding-top:5px;
    	padding-bottom:5px;
    	width:200px;
    	border:1px solid #e5e5e5;
    	}
    	.name:focus {
    	border:1px solid #d4d2d2;
    	}
    	.submit {
    	display:block;
    	background-image:url('pictures/login.png');
    	height:26px;
    	width:74px;
    	}
    	.submit:hover {
    	background-position:0 -38px;
    	}
    	a.submit {
    	padding-top:9px;
    	font-size:13px;
    	color:#cdcdcd;
    	}
    	a.submit:hover {
    	color:#959595;
    	}
    /* End of Index Login */
    /* Index Top */
    	.body {
    	background-image:url('pictures/index_top.png');
    	background-repeat:repeat-x;
    	}
    	#logo li a {
    	background-image:url('pictures/logo.png');
    	display:block;
    	}
    	.logo {
    	width:176px;
    	height:52px;
    	}
    	#logo a.logo:hover {
    	background-position: 0px -52px;
    	}
    /* End of Index Top */
    Thanks in forward

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    The problem can be viewed here: www.zixoo.net
    Really?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Jan 2011
    Location
    Slovenia
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Oops, I forgot to upload it. i'll upload it when I get home.

  • #4
    New Coder
    Join Date
    Jan 2011
    Location
    Slovenia
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts
    now it can be seen on www.zixoo.net
    I updated the page

  • #5
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    delete the "menu" div, float ul#logo to the left, add an id to the <ul> of "register, home" and float it to the right.

    Code:
    #index_top { height: 52px; }
    
    #index_top ul#logo { float: left; }
    
    #index_top ul#register { float: right; }
    Code:
    <div id="index_top">
      <ul id="logo">
      </ul>
      <ul id="register">
      </ul>
    </div>

  • Users who have thanked Sammy12 for this post:

    oxxiz (07-03-2011)

  • #6
    New Coder
    Join Date
    Jan 2011
    Location
    Slovenia
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts
    thanks :P
    now how about that "changing the background" problem ? and the logo should be higher and not that low (it's now on the orange line). you can check it out on the page. I tried margin-bottom but it won't work at all
    Last edited by oxxiz; 07-03-2011 at 11:18 PM.

  • #7
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    reset your tags


    stick this in a style tag at the top of the page
    Code:
    body, html, div, fieldset, form, img li, ol, p, ul { 
    	margin: 0;
    	padding: 0;
    }
    
    img { border: 0; }
    
    fieldset { border: 0; }
    input { margin: 0; }
    
    a { color: #03C; outline: none; border: 0; text-decoration: none; }
    a:hover { text-decoration: underline }
    All tags have default margins and paddings, so you want to set them to 0.

  • Users who have thanked Sammy12 for this post:

    oxxiz (07-03-2011)

  • #8
    New Coder
    Join Date
    Jan 2011
    Location
    Slovenia
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts
    thanks again as you see I'm not good in css yet ...
    and one more thing:
    how can I center the logo now? so the logo will be in the middle?
    I tried <center> and deleting the float:left; part but the hrefs are then below the orange line...
    and really, I appreciate your help!

  • #9
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    Code:
    ul#logo {
     width: 176px;
     margin: auto;
    }
    you have to take the float out from the logo though.

  • #10
    New Coder
    Join Date
    Feb 2011
    Posts
    41
    Thanks
    0
    Thanked 4 Times in 4 Posts
    Hello ,

    provide width and margin:0 auto to

    Code:
    #index_top{}
    so that both will remain in center of the header

    any more question please let me know

  • #11
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts
    instead of using
    Code:
    body, html, div, fieldset, form, img li, ol, p, ul {      margin: 0;     padding: 0; }
    you can use...
    Code:
    * {
    margin:0;
    padding:0;
    }

  • #12
    New Coder
    Join Date
    Jan 2011
    Location
    Slovenia
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts
    used that, and you can check the results on the page. (here is the link again).
    you see, now the home and register links are under the orange line, which is what I don't want.

    have a nice day

  • #13
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts
    Can you share image of layout how you want... I can help you in better way

  • #14
    New Coder
    Join Date
    Jan 2011
    Location
    Slovenia
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts
    here is a quick photoshop mockup:

  • #15
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts
    Please use below given CSS
    Code:
    * {
        margin:0;
        padding:0;
    }
    body {
        background:url(index.jpg) repeat;
    }
    #header {
        background:#EEE;
        border-bottom:3px solid #F90;
        height:100px;
    }
    .center {
        width:960px;
        margin:0 auto;
        height:100%;
    }
    #header a{
        display:block;
        width:20%;
        float:left;
        vertical-align:middle;
        color:#F90;
        font:bold 12px Verdana, Geneva, sans-serif;
        text-decoration:none;
        text-align:center;
        padding:30px 0;
    }
    #header #logo {
        width:60%;
        float:left;
        text-align:center;
    }
    #header #logo *{
        display:block;
        margin:10px auto 0;
    }
    here is HTML:

    Code:
        <div id="header">
            <div class="center">
                <a href="#">Menu 1</a>
                <div id="logo">
                    <img src="vikram.jpg" width="200" height="50" alt="logo" title="logo" />
                    <input type="text" width="200" />                
                </div>
                <a href="#">Menu 2</a>
            </div>
        </div>
    Cheers


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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