html - 创建一个比其他子菜单大的子菜单以包含表格

标签 html css yui-pure-css

我有一个 Verticle nav spry 菜单,我试图让我的最后一个选项是登录,一个更大(更宽和更高)的部分弹出而不是其他菜单 anchor 的较小部分。我不太确定该怎么做,我会创建另一个 css 类并只给菜单的那个部分吗?我对 css 很陌生,如果这很简单,请原谅我。我试图插入一个纯 css 表单,以便在我悬停时弹出登录信息。这是我尝试的 css,但没有成功

#login {
    width: 20em;
    height: 30em;
    background: #666;
    position: absolute;
    right: -20em;
    top: 0px;
    display: none;
}

但这里是网站的 jsfiddle:http://jsfiddle.net/5TfpH/

在此先感谢您帮助新手!

最佳答案

我已经添加了一些 css 样式来解决你的错误:

body {
	background-color: #A3A3A3;
	font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
}
nav {
	background: #666;
	padding-top: 10em;
	width: 10em;
	position: absolute;
	top: 0;
	bottom: 0;
}
nav ul {
	margin: 0;
	padding: 0;
	list-style: none;
}
nav ul a:hover, ul a:focus {
	background-color: #333;
}
nav ul li {
	position: relative;
}
nav ul li a {
	text-align: center;
	display: block;
	padding: 1em;
	color: #A3A3A3;
	text-decoration: none;
}
nav ul li ul {
	width: 10em;
	background: #666;
	position: absolute;
	right: -10em;
	top: 0px;
	display: none;
}
nav ul li ul:last-child {
	border-radius: 0 15px 15px 0;
}
nav ul li ul li:first-child a:hover {
	border-radius: 0 15px 0 0;
}
nav ul li ul li:last-child a:hover {
	border-radius: 0 0 15px 0;
}
nav ul li:hover > ul {
	display: block;
}
body h1 {
	vertical-align: central;
}
.pure-form {width: 15em;
	background: #666;
	position: absolute;
	right: -15em;
	top: 0px;
	display: none;}
.login:hover .pure-form {display:block;}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="sideMenu.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.3.0/pure-min.css">
</head>

<body>
<nav>
  <ul>
    <li><a href="index.html">Home</a></li>
    <li><a href="#">Profile</a></li>
    <li><a href="#">Post Jobs</a>
      <ul>
        <li><a href="#">Type 1</a></li>
        <li><a href="#">Type 2</a></li>
        <li><a href="#">Type 3</a></li>
      </ul>
    </li>
    <li><a href="#">Browse Jobs</a>
      <ul>
        <li><a href="#">Type 1</a></li>
        <li><a href="#">Type 2</a></li>
        <li><a href="#">Type 3</a></li>
        <li><a href="#">Type 4</a></li>
        <li><a href="#">Type 5</a></li>
        <li><a href="#">Type 6</a></li>
      </ul>
    </li>
    <li><a href="#">Contact</a></li>
    <li class="login"><a href="#">Login</a>
      <form class="pure-form pure-form-stacked">
        <fieldset>
          <label for="email">Email</label>
          <input id="email" type="email" placeholder="Email">
          <label for="password">Password</label>
          <input id="password" type="password" placeholder="Password">
          <label for="remember" class="pure-checkbox">
            <input id="remember" type="checkbox">
            Remember me </label>
          <button type="submit" class="pure-button pure-button-primary">Sign in</button>
        </fieldset>
      </form>
    </li>
  </ul>
</nav>
</body>
</html>

关于html - 创建一个比其他子菜单大的子菜单以包含表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21594340/

相关文章:

javascript - Jquery 鼠标悬停值

css - IE 8 中的 HTML5 和 CSS 内联无序列表

css - 纯 CSS : Responsive images breaking columns with border-box and padding on Firefox and Opera

html - 我的内容超出了部分的背景颜色

jQuery 返回以 px 为单位的高度,即使它是以百分比定义的

javascript - 在 YUI Pure CSS 中更改较小宽度屏幕上的 div 顺序

css - Safari 中的响应列

jquery - 超链接节点的所有子元素是否也有链接?

html - 无法设置字体粗细

javascript - 如何在选择文件按钮上显示完整的文件名