Outputting main contents from the top

I have a web page at http://form.kr/q/swap13/
If you click the menu1 menu2 or menu3 after uploading the page, the menu1 menu2 or menu3 element will be shown just above the main contents.
Some of main contents, especially in the center area horizontally, will be hidden by the menu element.
Okay, so far so good.

My problem is in the position of the main contents.
The position of the main contents is below the menu button wrap.
I like to put the main contents is under the menu button wrap.

The code below is one of my trails for it.

.main{ position:absolute; top:0px; }
And the code below on the button related is another trial for it.

z-index:3;

How can I make the main contents to output from the top?

I am not exactly sure of your requirements and think the following may be what is required:

https://this-is-a-test-to-see-if-it-works.tk/sp/sp-j/joon1/layout/index-001.php

Source code is shown in the web-page.

Thank you for your concerning.

At https://this-is-a-test-to-see-if-it-works.tk/sp/sp-j/joon1/layout/index-001.php,
the main content “This is main contents” is, I am afraid, below the 3 buttons.

What I want is that the main content "This is main contents is under the 3 buttons instead of below the 3 buttons.

Under links in the main contents are no relation with what I want, it is just for checking whether clickable or not.

Then you will need to remove the buttons from the flow using position:absolute.

e.g.

.button-wrap {
  position: absolute;
  max-width: 50rem;
  margin: 10px auto;
  padding: 10px;
  background: #eee;
  display: flex;
  justify-content: center;
  left: 0;
  right: 0;
}

Of course that will affect the position of the revealed elements but I have no real idea where you want those now as your posts never have any logic to them I guess you are just playing around and trying things out ;). The revealed divs will now be on top of the buttons so you won’t be able to use the buttons. You would need to change the html so that the revealed buttons are inside the button-wrap html and then they will appear below the buttons.

<div class="button-wrap">
  <div data-destination="menu1" class="button">menu1</div>
  <div data-destination="menu2" class="button">menu2</div>
  <div data-destination="menu3" class="button">menu3</div>

  <div class="menu" id="menu1">
    This is menu1 element. This is menu1 element. This is menu1 element.
  </div> 

  <div class="menu menu2 " id="menu2">
This is menu2 element. This is menu2 element. 
This is menu2 element. This is menu2 element. This is menu2 element. 
This is menu2 element. This is menu2 element. This is menu2 element. 
This is menu2 element. This is menu2 element. This is menu2 element. This is my DIV2 element. 
  </div> 

  <div class="menu menu3" id="menu3">
    This is menu3 element.
  </div> 
</div>

Then you will need:

.show{top:100%}

Of course that’s just a guess :slight_smile:

2 Likes

The screenshot of yours looks what I want.
But I can’t make the screenshot of yours by code.

The page at http://form.kr/q/swap14/ which is one of my trials for making the screenshot of yours doesn’t looks the screenshot of yours.

The main contents is below the 3 buttons at http://form.kr/q/swap14/ while the main contents is under the 3 buttons at the screen shot of yours.

http://form.kr/q/swap15/ is another trial for it, but failed.

What’s wrong in my code at http://form.kr/q/swap14/?

.button-wrap {
  position: absolute;/* not relative*/
etc...

Thank you. it works fine at http://form.kr/q/swap16/
I changed 1 thing from your code like the following.

The reason why I changed the background from #eee to pink is that I have one more requirement on it.

I like to remove the pink box. So my target result is the quote below.

Rather than messing about with z-indexes use pointer events instead:

  1. Remove the background color

  2. Add pointer-events:none to button-wrap: and pointer-events:initial to .button.

  3. No change needed.

.button-wrap{pointer-events:none;}
.button{pointer-events:initial;}

I did remove all z-index like the below at http://form.kr/q/swap19/

It works fine as my requirement.
Thank you very much.

I have one more requirement to it.
It is like the following.

The page at http://form.kr/q/swap20/ is one of my trials for making them clickable, but failed.
The following is what I modified for making http://form.kr/q/swap20/ from http://form.kr/q/swap19 .

I didn’t tell you to remove any z-indexes? Leave them alone.

What did you not understand about this requirement that you didn’t implement.

Read my post again and follow all the requirements as stated.:slight_smile:

Thank you very much.
It works fine at http://form.kr/q/swap21/

1 Like

I found a problem at http://form.kr/q/swap21/

In order to show the problem more clearly, I made a page
at http://form.kr/q/swap22/
The overLinks in each DIV element at http://form.kr/q/swap22/ are, I am afraid, NOT clickable.

http://form.kr/q/swap23/ is one of my trials for making the overLinks clickable.
I added to the css code like the following

Can I make the overLinks clickable with your help?

Add pointer-events:initial to .show.

You should have been able to work what out for yourself based on what we did for the buttons.:slight_smile:

It works fine at http://form.kr/q/swap24/
Thank you as always.

http://form.kr/q/swap27/ has some text & link next to menu button.

I like to put the text & link below the menu buttons instead of next to the menu buttons

More information of the new requirement above is in the quote below.

Thanks in advance

The problem with making things up as you go along is that you end with the wrong code for the new situation. Html is usually built to satisfy the constraints of the design so when you change the constraints considerably you have to change the html. You can’t just add something and expect it to work.

You need to adjust the html to accommodate a new block within that context as you can’t have the new block as a child of the flex block otherwise it behaves like the button.

2 Likes

By adding the code above to your code for making betweenLink clickable,
It works fine at http://form.kr/q/swap29/.
Thank you very much.

Yes I left that for you to work out :slight_smile:

1 Like

Would this method be equivalent to AJAX where you could have menus on the top and text displaying underneath the menu?

Thank you.

I’m not sure what Ajax has got to do with anything but Joon’s layout have specific requirements hence the complicated layering methods required.

If you have need of something similar then best to start a new thread :slight_smile: