Positioning div right under an a tag

John Baker

I'm trying to make a drop down menu to appear right under the URL that opens it up. So far I've managed to make a menu appear, but I can't figure out how to position it properly. My HTML looks like this

<div id="container">
  Content here
  <div class="line-gray-footer"></div>
  <div class="footer">
    <a href="#">Link 1</a> | <a id="langSwitch">English ▼</a>
    <div id="dropdown" class="drop-choices">
      <a class="choice" href="/de">Deutsch</a>
      <a class="choice" href="/fr">Français</a>
      <a class="choice" href="/it">Italiano</a>
      <a class="choice" href="/es">Español</a>
    </div>  
  </div>
  <div class="morestuff">
  <table>
  <tr>
    <th>Test</th><th>Test</th>
  </tr>
  <tr>
    <td>A</td><td>b</td>
  </tr>
  </table>
  </div>
</div>

CSS

#container{
  width:70%;
  background: red;
  margin: 0 auto;
  height:800px;
}
.line-gray-footer {
    background: #ececec none repeat scroll 0 0;
    height: 3px;
    margin: 10px 10px;
}
.footer {
    text-align: center;
}

.drop-choices.inuse {
    opacity: 1;
    visibility: visible;
    display: block;
}

.drop-choices {
    background-color: white;
    border: 1px solid gray;    
    border: medium none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.24);
    display: none;
    line-height: normal;
    margin-top: 0;    
    opacity: 0;
    position: absolute;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) 0s;
    visibility: hidden;
    white-space: nowrap;
    z-index: 100;    

}

.drop-choices a.choice {
    border-bottom: 1px solid #edf1f3;
    color: #777;
    padding: 3px 12px;
    transition: all 0.1s ease 0s;
    cursor: pointer;
    display: block;
    padding: 2px 3px 1px;
}
.morestuff table{
  width: 100%;
  border: 1px solid black;
}

Here is a jsFiddle URL of the whole thing https://jsfiddle.net/jaktav3t/

shabudeen shaikh

You just put parent div and set display: inline-block it will work

 <div class="footer">
        <a href="#">Link 1</a> | <div style="display: inline-block">

            <a id="langSwitch">English ▼</a>
            <div id="dropdown" class="drop-choices">
          <a class="choice" href="/de">Deutsch</a>
          <a class="choice" href="/fr">Français</a>
          <a class="choice" href="/it">Italiano</a>
          <a class="choice" href="/es">Español</a>
        </div>  
        </div>

      </div>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Center and Right div Positioning

From Dev

Positioning div to the right with an undefined width

From Dev

positioning a fixed div under another div for scrolling

From Dev

Div under div right aligned

From Dev

Positioning a div right below notification center

From Dev

Centring a div with left, right, and absolute positioning

From Dev

Positioning a box in the top right of a div using :after

From Dev

CSS: Positioning an IMG tag within a div with overflow

From Dev

Right DIV tag not working with padding

From Dev

How to use a sprite for a background on a div, positioning to a part of the sprite to the right of the div

From Dev

How to use a sprite for a background on a div, positioning to a part of the sprite to the right of the div

From Dev

Positioning a div to the left with right-aligned div inside a container

From Dev

Positioning div off-screen to the right using jQuery

From Dev

Positioning AJAX results in the right DIV by using "rel" attribute

From Dev

Positioning div off-screen to the right using jQuery

From Dev

Positioning div right to a already centered content without absolute position

From Dev

How to align DIV right or left or center in CSS without absolute positioning?

From Dev

Keep div from going under image with absolute positioning

From Dev

Keep div from going under image with absolute positioning

From Dev

Moving Div to the right of a column and under another column

From Dev

Position div tag at the bottom right of an image

From Dev

move span element right to div tag

From Dev

Getting a dynamic element under a div tag

From Dev

How to prevent right div from wrapping under the left div?

From Dev

How to prevent right div from wrapping under the left div?

From Dev

<div> tag disappears under a floated element, but a <p> tag or text does not?

From Dev

Jsoup accessing div tag under table tag not working

From Dev

Website layout not positioning right

From Dev

CSS/JS/jQuery positioning of div that animates under another div....like a drop down

Related Related

  1. 1

    Center and Right div Positioning

  2. 2

    Positioning div to the right with an undefined width

  3. 3

    positioning a fixed div under another div for scrolling

  4. 4

    Div under div right aligned

  5. 5

    Positioning a div right below notification center

  6. 6

    Centring a div with left, right, and absolute positioning

  7. 7

    Positioning a box in the top right of a div using :after

  8. 8

    CSS: Positioning an IMG tag within a div with overflow

  9. 9

    Right DIV tag not working with padding

  10. 10

    How to use a sprite for a background on a div, positioning to a part of the sprite to the right of the div

  11. 11

    How to use a sprite for a background on a div, positioning to a part of the sprite to the right of the div

  12. 12

    Positioning a div to the left with right-aligned div inside a container

  13. 13

    Positioning div off-screen to the right using jQuery

  14. 14

    Positioning AJAX results in the right DIV by using "rel" attribute

  15. 15

    Positioning div off-screen to the right using jQuery

  16. 16

    Positioning div right to a already centered content without absolute position

  17. 17

    How to align DIV right or left or center in CSS without absolute positioning?

  18. 18

    Keep div from going under image with absolute positioning

  19. 19

    Keep div from going under image with absolute positioning

  20. 20

    Moving Div to the right of a column and under another column

  21. 21

    Position div tag at the bottom right of an image

  22. 22

    move span element right to div tag

  23. 23

    Getting a dynamic element under a div tag

  24. 24

    How to prevent right div from wrapping under the left div?

  25. 25

    How to prevent right div from wrapping under the left div?

  26. 26

    <div> tag disappears under a floated element, but a <p> tag or text does not?

  27. 27

    Jsoup accessing div tag under table tag not working

  28. 28

    Website layout not positioning right

  29. 29

    CSS/JS/jQuery positioning of div that animates under another div....like a drop down

HotTag

Archive