0
I can’t put on the same page, for example two menus.
Let me explain. I use the unordered lists and the inline display to create a horizontal menu.
I do the same to further down the page create another.
What I think is failing is to individualize both. I am using the ID on ul
and in the li
of the two menus. In menu 1 I am using a different ID for the ul
and another to the li
(in the case of lists I use the same ID name for all). And I do the same for the second menu of course the ID s are different from the first menu.
Well, the goal is to have the ability to use independent formatting. I’m not getting.
I’ve looked at a lot of sites and books and can’t find anything. Can anyone help me? I’m taking my first steps in practice. Thank you.
Below you have an example. I did not put everything right as for example the etc is only what matters for the exercise
<ul class="menu1">
<li><a href="#">EXEMPLO</a></li>
<li><a href="#">EXEMPLO</a></li>
<li><a href="#">EXEMPLO</a></li>
</ul>
<ul class="menu2">
<li><a href="#">EXEMPLO</a></li>
<li><a href="#">EXEMPLO</a></li>
<li><a href="#">EXEMPLO</a></li>
</ul>
Then in css it’s like this:
.menu1 ul {
list-style-type: none;
padding-top: 50px;
}
li {
font-family: globerthin, Verdana, Arial, Geneva, sans-serif;
display: inline;
margin: 10px;
padding: 30px;
font-size: 12px;
font-family: globerthin, Verdana, Arial, Geneva, sans-serif;
}
.menu1 a:link{
color: green;
text-decoration: none;
margin-top: 20px;
}
a:visited {
color: black;
text-decoration: none;
}
a:hover{
background-color: #faf6eb;
text-decoration: none;
}
a:active{
color: black;
text-decoration: underline;
background-color: #faf6eb;
}
Menu two is like this:
.menu2 ul {
list-style-type: none;
padding-top: 30px;
}
li {
font-family: globerthin, Verdana, Arial, Geneva, sans-serif;
display: inline;
margin: 10px;
padding: 30px;
font-size: 12px;
font-family: globerthin, Verdana, Arial, Geneva, sans-serif;
}
#menu a:link{
color: green;
text-decoration: none;
margin-top: 20px;
}
a:visited {
color: black;
text-decoration: none;
}
a:hover{
background-color: #faf6eb;
text-decoration: none;
}
a:active{
color: black;
text-decoration: underline;
background-color: #faf6eb;
}
Would it be possible to provide the code to take a look? You mentioned that you are using for li the same ID, I believe not to be the best approach, an ID should not repeat itself within the same HTML code, it should be unique, for the li I suggest you use the class element as this yes can be repeated and serves as visual formatted.
– Fábio Jânio
Hello. I know that the class is used when we want to repeat the css and the ID is the unique element. Although the two have the same effect in practice. However, in theory if we work with several people on external css pages they know what is unique in the html page. The problem is not there... maybe it is in the repetition of the attributes "li". I’m still studying to see if I find the mistake. The problem is not whether to use ID or class.
– David
The problem is how I do two horizontal menus with different properties. If you try to make two horizontal menus you will see that when you try to position them they orient in the same way. I think the problem may be related to elements "a" and so on... thank you for your help.
– David
What have you got so far? Edita your question and add to it the XHTML and CSS code of what you already have so far.
– Chun
Put html and css code in your post.
– Fábio Jânio
I think I’ve already discovered or partially discovered it. First of all note that the "a" property also has its role in css. Then I’m noticing that instead of specifying the code by putting the "li plus a Cass or the id" we should just put the id or the class. I still do not know the reason or understand well how works the lists to make menus and more lists with various styles on the same page. I think I’m walking the right path.
– David