Here is my code:

这是我的代码:

a) I have a row of buttons at the top formatted horizontally as such:

a)我在顶部有一排按钮,水平格式如下:

HTML:

<ul class="nav"> 
<a href="#jobs"class="button1">Work</a>
<a href="#volunteer" class="button2"> Volunteer</a>
<a href="#education" class="button3"> Education</a>
<a href="#skills" class="button4"> Skills</a> 
<a href="#references" class="button5"> References</a>
<a href="#images" class="button6"> Images</a> 
</ul>

b) I have div blocks each displaying a paragraph:

b)我有div块,每个块显示一个段落:

<div class="jobs"> 
<h2>text</h2> 
<h3>text</h3> 
<h4>text</h4> 
</div>

c) I want the CSS to not display the jobs div yet:

c)我希望CSS不显示作业div:

.jobs {
   display: none;
}

d) Now that I hover over the first button I want the jobs div to display:

d)现在我将鼠标悬停在第一个按钮上,我希望显示作业div:

.button1:hover+.jobs {
display: block
    }

e) Repeat for all other div sections

e)对所有其他div部分重复

.volunteer {
       display: none;
    }

    .button2:hover+.volunteer {
        display:block

    }

4 个解决方案

#1


0

You will need to markup HTML differently.

您需要以不同方式标记HTML。

.jobs, .volunteer {
   display: none;
}
.button1:hover+.jobs, .button2:hover+.volunteer {
   display: block;
   /* position the divs under the navigation links */
   position: absolute;
   top: 120px;
}
<ul class="nav"> 
  <li>
    <a href="#jobs"class="button1">Work</a>
    <div class="jobs"> 
      <h2>h2 jobs</h2> 
      <h3>h3 jobs</h3> 
      <h4>h4 jobs</h4> 
    </div>
  </li>
  <li>
    <a href="#volunteer" class="button2"> Volunteer</a>
    <div class="volunteer"> 
      <h2>h2 volunteer</h2> 
      <h3>h3 volunteer</h3> 
      <h4>h4 volunteer</h4> 
    </div>
  </li>
  <li><a href="#education" class="button3"> Education</a></li>
  <li><a href="#skills" class="button4"> Skills</a></li>
  <li><a href="#references" class="button5"> References</a></li>
  <li><a href="#images" class="button6"> Images</a></li>
</ul>

更多相关文章

  1. JSP 或HTML 如何通过button按钮转到想去的页面
  2. HTML5按钮元素新属性formaction,formenctype等简介
  3. 按钮怎么变灰?
  4. 如何让按钮点击之后才能点击注册,再次点击按钮可以使按钮变为未勾
  5. 单选按钮和多选按钮的样式设置
  6. 在Chtmlview中,浏览多frame的框架的网页,有时点击按钮,这时只会触发
  7. 如何使用ajax向php发送与每个按钮相关的数据?
  8. 按钮和文本移回原始位置
  9. 在返回按钮上重新加载页面。

随机推荐

  1. 五分钟知识小科普:什么是 Base64编码
  2. 几道和「二叉树」有关的算法面试题
  3. 小伙Python爬虫并自制新闻网站,太好玩了
  4. 昨天,终于拿到了腾讯 offer
  5. 独乐乐不如众乐乐,如何装逼的求众数
  6. 拜托,面试官别问我「布隆」了
  7. 使用快慢指针求解「环形链表」so easy!
  8. 动画:七分钟理解什么是KMP算法
  9. 推荐一个项目:数据结构和算法必知必会的 5
  10. 拓扑排序原理与解题套路