5

I have a menu with tabs, and on hover of a tab a list of things appear at the bottom of the tab. Then, I wanted to do that the list of thing go down with a transition( before it was display:block). My problem is that when the transition will start, the top of the list must be a certain multiplication ( the width of a tab * the number of tabs ). But I don't want any javascript.

Is there a way to do that ?

4
  • 3
    post your code here if you want serious answer. Commented May 6, 2012 at 6:13
  • 2
    I'm sorry I don't have it now. But maybe in two days. Commented May 6, 2012 at 6:14
  • 1
    please insert your Html and css code Commented May 6, 2012 at 6:16
  • 1
    use the answer of morteza tavakoli as exemple Commented May 6, 2012 at 6:39

2 Answers 2

14

it is my sample of css dropdown menu: i hope be useful:

in HTML, and CSS:

#menu, #menu ul
{
	list-style: none;
	border: 1px solid #000;
	background-color: #ecffec;
	padding: 0 0 26px 0;
	margin: 0;
}
#menu li
{
	float: left;
	margin-right: 3px;
	border: 1px solid #ecffec;
	position: relative;
}
#menu ul
{
	position: absolute;
	top: 25px;
	left: -1px;
	width: 200px;
	padding: 0;
	display: none;
}
#menu ul li
{
	float: none;
	margin: 0;
	padding: 0;
	line-height: 15px;
}
#menu a:link, #menu a:visited
{
	display: block;
	font-family: Tahoma;
	font-size: 0.75em;
	font-weight: bold;
	text-align: left;
	text-decoration: none;
	color: #000;
	padding: 5px;
}
#menu li:hover
{
	background-color: #ffd98a;
	border: 1px solid #000;
}
#menu li:hover ul
{
	display: block;
}
<ul id="menu">
  <li><a href="#">Programming Language</a>
    <ul>
      <li><a href="#">Java</a></li>
      <li><a href="#">PHP</a></li>
      <li><a href="#">Python</a></li>
      <li><a href="#">Asp Classic</a></li>
      <li><a href="#">ASP.NET</a></li>
      <li><a href="#">javascript</a></li>
      <li><a href="#">Perl</a></li>
    </ul>
  </li>
  <li><a href="#">Database</a>
    <ul>
      <li><a href="#">SQL Server 2005</a></li>
      <li><a href="#">Oracle</a></li>
      <li><a href="#">MySQL</a></li>
      <li><a href="#">DB2</a></li>
    </ul>
  </li>
   <li><a href="#">Help</a></li>
</ul>

Sign up to request clarification or add additional context in comments.

6 Comments

@user1365010 what is missing from this?
@ScottBartell Simply, this is not the answer of my question but just an example to work on. See the comments of the question
also see example at ourtuts.com/…
@Morteza Thanks for your code its useful. However a get a transparent dropdown block, do you know how to make it an opaque one?
in "#menu li:hover ul" section add opacity: 0.5. opacity can change between 0 and 1. full transparent or opaque
|
0

Have you seen https://codepen.io/markcaron/pen/wdVmpB?

html part

<h2>Checkbox version</h2>

<div class="dropdown">
  <input type="checkbox" id="my-dropdown" value="" name="my-checkbox">
  <label for="my-dropdown"
     data-toggle="dropdown">
  Choose one
  </label>
  <ul>
    <li><a href="#">Coffee</a></li>
    <li><a href="#">Coverage</a></li>
    <li><a href="https://twitter.com/hashtag/covfefe">Covfefe</a></li>
  </ul>
 </div>


<h2>Anchor version</h2>

 <div class="dropdown">
  <ul id="my-dropdown2">
    <li><a href="#">Coffee</a></li>
    <li><a href="#">Coverage</a></li>
    <li><a href="https://twitter.com/hashtag/covfefe">Covfefe</a></li>
 </ul>
  <a href="#my-dropdown2"
    aria-controls="my-dropdown2"
    role="button"
    data-toggle="dropdown"
    id="my-dropdown2-btn">
  Choose one
  </a>
     <a href="#my-dropdown2-btn"
     aria-controls="my-dropdown2"
    role="button"
     data-toggle="dropdown"
     class="close">
  Close dropdown
  </a>
 </div>

css part

better to see the link above! check it out!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.