Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on some website that is designed for users to move from section to section horizontally and vertically. So user needs to be able to click on the footer button on every section and it send him to next section which is on the right side from current section, for footer button on that section user should go to the next section which is down, after that left, down and so on. On the first image you can see how website look like from zoom out perspective. On second image how the website should look like on mobile device and on third what happened when user scrolls on the side with his fingers.
Problem is that I want to disable user to scroll the website horizontally by himself. With 'overflow:hidden' it works for desktop size (if I try to move on the side with keyboard arrows it will not scroll and that's good), only need to implement this method for mobile devices.

https://i.stack.imgur.com/eal0s.png[^]

What I have tried:

* {
  margin: 0;
  box-sizing: border-box;
}

body {
  background-color: black !important;
  color: #fff !important;
  overflow-y: hidden;
  overflow-x: hidden;
}

.connection {
  display: flex;
  width: 200%;
}

.home {
  height: 50vh;
  background: rgb(109, 106, 106);
}

a {
  color: white !important;
}
<div id="first" class="home">
  <p>coonection</p>
  <br>
  <a href="#second">next</a>
</div>

<div class="connection">
  <!-- VALUES 5 -->
  <div id="second" class="internal">
    <div class="purp">
      <p class="rowText">SECTION 1</p>
      <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime mollitia, molestiae quas vel sint commodi repudiandae consequuntur voluptatum laborum numquam blanditiis harum quisquam eius sed odit fugiat iusto fuga praesentium optio, eaque rerum!,
        voluptatum laborum numquam blanditiis harum quisquam eius sed odit fugiat iusto fuga praesentium optio, eaque rerum!voluptatum laborum numquam blanditiis harum quisquam eius sed odit fugiat iusto fuga.</p>
      <br>
      <a href="#third">next</a>
    </div>
  </div>

  <div id="third" class="internal">
    <div class="purp">
      <p class="rowText">SECTION 2</p>
      <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime mollitia, molestiae quas vel sint commodi repudiandae consequuntur voluptatum laborum numquam blanditiis harum quisquam eius sed odit fugiat iusto fuga praesentium optio, eaque rerum!,
        voluptatum laborum numquam blanditiis harum quisquam eius sed odit fugiat iusto fuga praesentium optio, eaque rerum!voluptatum laborum numquam blanditiis harum quisquam eius sed odit fugiat iusto fuga.</p>
      <br>
      <a>next</a>
    </div>
  </div>
</div>
Posted
Updated 24-Feb-22 9:02am

You have to twll your app the difference between screen sizes i.e. pc, tablet and phone...

To do that, you need to specify each size and what is required to display it properly. I always spend some time here as this make your app work or just create aggrevation for your users -

As samples, see below code -

NORMAL SCREEN
.pwdinput {
	font-size: 18px;
	font-weight: 500;
	text-align: center;


/*Device = Low Resolution Tablets, Mobiles (Landscape or smaller tablets...)
  ##Screen = B/w 481px to 767px*/

@media (min-width: 481px) and (max-width: 767px) {
	.pwdinput {
		font-size: 16px;
		font-weight: 500;
		text-align: center;


/*Device = Most of the Smartphones Mobiles (Portrait)
  ##Screen = B/w 320px to 479px*/

@media (min-width: 320px) and (max-width: 480px) {
		.pwdinput {
			font-size: 16px;
			font-weight: 500;
			text-align: center;


Inside each you can now add BLOCK, SIZE etc to make it work for you.
 
Share this answer
 
v2
Hi Andre, thanks for giving the solution. I found the right one, just need to add in css file the html with body like this:
html, body {
overflow-x: hidden;
overflow-y: hidden;
}
 
Share this answer
 
Comments
PIEBALDconsult 25-Feb-22 10:50am    
Please don't try to answer your own question. You may add further detail to your question by using "improve question".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900