SSV
SSV

Reputation: 860

Place two objects at THE SAME spot in css

Let's assume I have 2 objects, em and a button

 <button class="navigateButton" wicket:id="rw">Test1</button> 
 <em class="logoutButton"><a wicket:id="rw2">Test</a></em>

Is there any way to place two of those objects at exactly same spot without using position:fixed? In code I handle which one should be shown, since they do different functions. I want to show it at one specific spot, regardless which one is hidden. There are never 2 of those displayed at the same time.

Upvotes: 1

Views: 2756

Answers (2)

Alex McMillan
Alex McMillan

Reputation: 17952

Put them both into a container <div style="position:relative"> and give them

position: absolute;
top: 0;
left: 0;

Upvotes: 4

oguzhancerit
oguzhancerit

Reputation: 1572

As I understand, you want to click button and anchor at the same time with one click. You can use javascript for this purpose. Showing the 2 different objects at the same spot seems not good. Hide the em and use the below code.

$(".navigateButton").on("click",function(){
  $(".logoutButton a").click();
});

Upvotes: 0

Related Questions