I'm working on a responsive web design project. I have a problem, namely that I want to add a time and date to the written menu, which is to be in the upper right corner. In part I managed to achieve this effect, but unfortunately when the page changes size to the smallest possible, date and time overshadow list elements. For a few days I am trying to fix this, but I have no idea how to do it. Can you help me?
P.S. At the bottom of the page I also have a collapse navbar that works well. The best option would be to modify the code below
function date_time(id)
{
date = new Date;
year = date.getFullYear();
month = date.getMonth();
months = new Array('styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień');
d = date.getDate();
day = date.getDay();
days = new Array('Niedziela,', 'Poniedziałek,', 'Wtorek,', 'Środa,', 'Czwartek,', 'Piątek,', 'Sobota');
h = date.getHours();
if(h<10)
{
h = "0"+h;
}
m = date.getMinutes();
if(m<10)
{
m = "0"+m;
}
s = date.getSeconds();
if(s<10)
{
s = "0"+s;
}
result = ''+days[day]+' '+d+' '+months[month]+' '+' | '+h+':'+m+':'+s;
document.getElementById(id).innerHTML = result;
setTimeout('date_time("'+id+'");','1000');
return true;
}
ul.topnav
{
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #000000;
font-family: Coda, sans-serif
font-size: 12px !important;
letter-spacing: 4px;
}
ul.topnav li
{
float: left;
}
ul.topnav li a
{
display: block;
color: #FFFFFF;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
ul.topnav li a:hover:not(.active)
{
background-color: #9ECB16;
}
@media screen and (max-width: 600px)
{
ul.topnav li {float: none;}
}
.clock
{
overflow: hidden;
background-color: #000000;
font-family: Coda, sans-serif;
font-size: 12px !important;
letter-spacing: 4px;
}
.clock p
{
display: block;
color: #FFFFFF;
text-align: center;
padding: 0 0 0 0;
text-decoration: none;
}
.topcorner
{
position: absolute;
top: 14px;
right: 16px;
}
<!-- CLOCK -->
<div class="clock topcorner">
<p id="date_time"></p>
<script type="text/javascript">window.onload = date_time('date_time');</script>
</div>
<!-- MENU -->
<ul class="topnav">
<li><a href="#">SALON</a></li>
<li><a href="#">SYPIALNIA</a></li>
<li><a href="#">KUCHNIA</a></li>
<li><a href="#">ŁAZIENKA</a></li>
<li><a href="#">PRZEDPOKÓJ</a></li>
</ul>