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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    having problems positioning the nav bar

    hi guys im doing code using html and css to make a website, but im having trouble at the moment positioning the nav bar to the right to align with my heading, ill show you the code for both the css and my html home page, and if anyone can see whats wrong please let me know, thanks.


    HTML:

    <!DOCTYPE html>
    <html>
    <head>
    <title>Lucia Pupilli - Home</title>
    <link rel="stylesheet" type="text/css" href="website.css">
    </head>

    <body class="background">

    <h1>Lucia Pupilli</h1>

    <div id="luciaPages">
    <ul>
    <li><a href="home.html">Home</a></li>
    <li><a href="bio.html">Bio</a></li>
    <li><a href="listen to me.html">Listen to me</a></li>
    <li><a href="gallery.html">Gallery</a></li>
    <li><a href="contact.html">Contact</a></li>
    </ul>
    </div>

    <div class="page">
    <video width="340" height="320" controls>
    <p>Click to see Lucia in action</p>
    <source src="luciavid.mp4" type="video/mp4">
    <!-- <source src="movie.ogg" type="video/ogg"> -->

    </source>
    Your browser does not support the video tag.
    </video>

    </div>

    </body>
    </html>



    CSS:

    .background{
    background-image: url(lucia2.jpg);
    background-repeat:no-repeat;
    background-color: black;
    }


    body {
    padding:0;
    color:white;
    border-color:white;
    background-color: white;
    overflow:auto;

    }

    .page{

    margin-top:-1%;
    margin-bottom:80%;
    margin-left:50%;
    margin-right:10%;

    color:none;
    border-color:none;
    background-color: none;

    }

    #bio{
    color: #C80000;
    }

    h1 {
    color: #C80000;
    font-family: Zapf Chancery, cursive;
    font-size: 50px;
    margin: 50px;
    }

    #luciaPages
    {
    width:100%;
    margin:0 0 2%;
    }

    ul {list-style-type: none; }

    li {display:inLine; float:left;}

    ul a {color:#C80000; padding-left:25px; padding-right:25px; text-decoration: none; line-height:1px; font-family: Zapf Chancery, cursive;}

    ul a:hover {color:white}

    .swapMe img { -webkit-transition: all 1s ease-in-out; -moz-transition: all 1s ease-in-out; -ms-transition: all 1s ease-in-out; -o-transition: all 1s ease-in-out; transition: all 1s ease-in-out; }
    .swap1, .swapMe:hover .swap2 { -webkit-opacity: 1; -moz-opacity: 1; opacity: 1; } .swapMe:hover .swap1, .swap2 { -webkit-opacity: 0; -moz-opacity: 0; opacity: 0; }

    </body>

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,669
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello james_taylor,
    To place those two elements side by side, you need to float one or both.

    Look at it like this -
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Lucia Pupilli - Home</title>
    <style type="text/css">
    .background { background: #000 url(lucia2.jpg) no-repeat; }
    body {
    	padding: 0;
    	color: white;
    	border-color: white;
    	background-color: white;
    }
    #header {
    	width: 100%;
    	overflow: auto; /*this clears floated h1*/
    }
    h1 {
    	width: 325px;
    	margin: 50px;
    	float: left;
    	color: #C80000;
    	font-family: Zapf Chancery, cursive;
    	font-size: 50px;
    	text-align: center;
    }
    ul#luciaPages { 
    	margin: 75px 0 0 325px;
    	list-style-type: none; 
    }
    li {
    	display: inLine;
    	float: left;
    }
    li a {
    	color: #C80000;
    	padding-left: 25px;
    	padding-right: 25px;
    	text-decoration: none;
    	line-height: 1px;
    	font-family: Zapf Chancery, cursive;
    }
    li a:hover { color: white }
    </style>
    </head>
    <body class="background">
        <div id="header">
            <h1>Lucia Pupilli</h1>
                <ul id="luciaPages">
                    <li><a href="home.html">Home</a></li>
                    <li><a href="bio.html">Bio</a></li>
                    <li><a href="listen to me.html">Listen to me</a></li>
                    <li><a href="gallery.html">Gallery</a></li>
                    <li><a href="contact.html">Contact</a></li>
                </ul>
        <!--end header--></div>
    </body>
    </html>
    See a float tutorial here.

    When posting code in the forum, please use the code tags, &#91;code&#93;&#91;/code&#93; - available with the # button in the post edit window.
    This will wrap your code in a scroll box which greatly helps the readability of your post.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Posting Permissions

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