- This topic is empty.
-
AuthorPosts
-
October 11, 2011 at 8:10 pm #34737mikedevMember
Hello, I’m new to css&html (3 days) and having an issue with creating a simple top, vertical menu bar with some style.
Here is what I have so far
–html–
–css–
#top-nav
{
list-style: none;
width: 100%;
margin: 0px;
padding: 1px;
background-color: black;
}
#top-nav li
{
display:inline;
}
#top-nav a.first
{
display:block;
float:left;
width: 60px;
height: 25px;
margin-left: 1px;
padding-left: 15px;
background-color: black;
font-family: Arial;
font-size: 18px;
text-transform: uppercase;
text-decoratoin: none;
color: fuchsia;
line-height: 25px;
}
without float: = http://i52.tinypic.com/2dh7ghu.pngwith float: = http://i53.tinypic.com/2rfg9ox.png
So there is an issue with the float command. I’m trying to keep everything together, with a vertical menu. But when I enter float, the links seem to separate from the top area. I’m trying to keep them together because I want the menu bar to take the entire width of the browser as it expands/decreases. Perhaps there is another way to still do that? If I don’t use the float command then the links stay horizontal. Perhaps there is a better way to be doing/stylzing the top menu bar of the site?
Thank You!
October 11, 2011 at 8:11 pm #88908October 11, 2011 at 8:16 pm #88909mikedevMemberso it seems the issue the more I look at it, is once I do the float the border/background in the top-nav id is not matching the height of the text/link li area. perhaps there is a command so that it will always match that area?
October 11, 2011 at 8:26 pm #88910mikedevMemberfiqured it out. By adding height command in the dev-nav area (matching px in the li css) this created a background matching the same size as the link area.
October 11, 2011 at 8:31 pm #88911jreinselMemberYou should setup your page with
tags This way you can format the page so you can have a sidebar.You should read up on style layouts and
tags.For the beginner this can be confusing so find a good book. One I recommend is “CSS The Missing Manual”
October 11, 2011 at 8:33 pm #88912chrisburtonParticipant@jreinsel Why does this person need a sidebar?
October 11, 2011 at 8:36 pm #88913jreinselMemberSince he wants a vertical menu it seemed appropriate. Love to hear your idea too.
October 11, 2011 at 8:41 pm #88914chrisburtonParticipantTechnically we don’t know what the page layout consists of and a sidebar might not be needed. I usually like to see an image of what the person is trying to accomplish or at least a detailed explanation.
October 11, 2011 at 8:52 pm #88916mikedevMemberHey guys, this should help out
trying to create: http://i53.tinypic.com/28cj155.jpg
what it looks like now: http://i56.tinypic.com/2pqsta8.png
here is my current css
—css—
#top-nav
{
list-style: none;
width: 100%;
margin: 1px;
height: 30px;
padding: 1px;
background-color: black;
}#top-nav li
{
display:inline;
}#top-nav a.first
{
display:block;
width: 80px;
height: 30px;
float: right;
margin-right: 22px;
margin-left: 1px;
margin-bottom: 1px;
margin-top: 1px;
padding-right: 1px;
background-color: black;
border-left:1px solid white;
font-family: Arial;
font-size: 18px;
text-transform: uppercase;
text-decoratoin: none;
color: lime;
line-height: 25px;
}The goal is to have a logo on the left hand side, with main menu on the right side (floating?). First goal is to establish links and then putting in images with hover effects.
If you look at my image, one issue is that my top menu items are not spaced well between each other. So I’m guessing I must setup a separate class for each link, and match them up accordingly by margin/padding based on the number of characters in each link?
October 11, 2011 at 9:01 pm #88917mikedevMemberI’m not sure if those top menus are even graphics. I’m aware that css3 allows for rounded edges with webkit.. so perhaps ultimately I will be able to get the desired style with just ccs3, to create rounded button links in the top menu.
October 11, 2011 at 9:46 pm #88918mikedevMemberupdate:
I was able to start to create rounded buttons by implementing some css3. css3 looks great :)
#top-nav
{
list-style: none;
width: 100%;
margin: 1px;
height: 80px;
padding: 1px;
background-color: black;
}#top-nav li
{
display:inline;
}#top-nav a.first
{
display:block;
width: 80px;
height: 10px;
float: right;
margin-right: 22px;
margin-left: 1px;
margin-bottom: 1px;
margin-top: 1px;
padding-right: 1px;
background-color: black;
border-left:1px solid white;
font-family: Arial;
font-size: 18px;
text-transform: uppercase;
text-decoratoin: none;
color: lime;
line-height: 25px;
border:3px solid #999;
padding:1em;
-moz-border-radius:8px;
-webkit-border-radius:8px;
-opera-border-radius:8px;
-khtml-border-radius:8px;
border-radius:8px;
}here is my current progress: http://i56.tinypic.com/6hnlg3.png
remaining issues:
1. not sure best way to attach an image to the header, correctly.
2. not sure how to make the buttons better aligned together. Text of button is not centered in button area.
3. If I change the name of one of the menu links, it expands a lot bigger then the button itself. Is there a way to have those buttons/menu items dynamic so depending on the size of the text, the button will grow vertically to match the amount of characters?thanks
October 11, 2011 at 9:51 pm #88920chrisburtonParticipantYou’re learning. Throw this in there
#top-nav li {
display:inline;
line-height: 80px;
}After we can help you distinguish what is wrong while helping you tidy up your css and a few other things.
October 11, 2011 at 9:54 pm #88921chrisburtonParticipantHere is a quick mockup: http://jsfiddle.net/5gWmA
October 12, 2011 at 1:19 am #88927mikedevMemberChristopher,
Here is an update implementing most of your help: http://jsfiddle.net/dunham100/nzxbp/4/
I had a few questions.
1. The header with background: logo is a new technique for me.. it appears a form of html5 to put a image in place of text. It appears to be good for seo? Is there any advantages or tips for all my projects to incorporate that vrs setting up a div for example, with the logo, alt tags, ect. For example:
“”
October 12, 2011 at 1:19 am #88928mikedevMember -
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.