skip to Main Content

I have own and develop a website www.frittfallfoto.no, to display my photo archive. Last Sunday Google Chrome suddenly changed the way it displays my menu system. I did not change any code, or encounter any errors. It seems the browser disregards the CSS max-width property, and lists my meny items in a long line extending out of the screen boundaries. Microsoft Edge browser displays the correct result. See images for understanding the problem:

Chrome image: https://www.frittfallfoto.no/Chrome-browser.jpg

Edge image: https://www.frittfallfoto.no/Edge-browser.jpg

What’s even stranger, the Chrome browser at my work computer displayed the correct result yesterday (Monday), and I verified the browser versions at home and work were identical (76.0.3809.132, 64-bit). Today, however, the problem was the same at the work computer.

Tried the code in W3schools try-it-editor, and it works there.

CSS:

#container {
max-width: 1140px;
width: 100%;
display: table;
text-align: justify;
}

.button {
  background-color: #ff7c3f; 
  border: none;
  outline: none;
  color: white;
  padding: 5px 10px 5px 10px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 15px;
 }

PHP code, simplified:

<?php
   echo "<div id='container'>";
   while($counter<$number_of_items)
   {
      echo "<a href='wp_arkiv.php?query'><button class='button'>DESCRIPTION</button></a>&nbsp;";
   }
   echo "</div>";
?>

HTML, actual code:

<div id='container'>
   <a href='wp_arkiv.php?punktID=1&=Geografisk'><button class='button'>Geografisk</button></a>&nbsp;<a href='wp_arkiv.php?punktID=7&administrativt=Norge'><button class='button'>Norge</button></a><br><br>
   <a href='wp_arkiv.php?punktID=131&administrativt=Akershus'><button class='button'>Akershus</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=132&administrativt=Aust-Agder'><button class='button'>Aust-Agder</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=133&administrativt=Buskerud'><button class='button'>Buskerud</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=134&administrativt=Finnmark'><button class='button'>Finnmark</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=135&administrativt=Hedmark'><button class='button'>Hedmark</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=136&administrativt=Hordaland'><button class='button'>Hordaland</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=137&administrativt=Møre og Romsdal'><button class='button'>Møre og Romsdal</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=138&administrativt=Nordland'><button class='button'>Nordland</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=139&administrativt=Oppland'><button class='button'>Oppland</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=140&administrativt=Oslo'><button class='button'>Oslo</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=141&administrativt=Rogaland'><button class='button'>Rogaland</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=142&administrativt=Sogn og Fjordane'><button class='button'>Sogn og Fjordane</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=143&administrativt=Telemark'><button class='button'>Telemark</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=144&administrativt=Troms'><button class='button'>Troms</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=145&administrativt=Trøndelag'><button class='button'>Trøndelag</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=146&administrativt=Vest-Agder'><button class='button'>Vest-Agder</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=147&administrativt=Vestfold'><button class='button'>Vestfold</button></a>&nbsp;
   <a href='wp_arkiv.php?punktID=148&administrativt=Østfold'><button class='button'>Østfold</button></a>&nbsp;
</div>

2

Answers


  1. Chosen as BEST ANSWER

    This problem is now solved. Turns out it was a buck in Chrome 77. With version 78 it all works like a charm again. Thanks.


  2. A better solution may be to change the container to display: flex;

    display:flex;
    flex-direction: row;
    flex-wrap: wrap;
    

    Do some research on flexbox. You’ll find it excellent at tackling many issues like this.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search