'I can't put a section with background above Google Maps iframe
I've got an issue, while trying to create an overlay above google maps iframe. The background-color isn't aplying in CSS. Are there any restrictions from Google and what's a proper solution to this?
.ellenonmap {
background-color:white!important;
text-align: center;
box-sizing: border-box;
width: 400px;
height: 400px;
margin-top: -300px;
margin-left: 100px;
}
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d100621.22936695188!2d23.66829933952863!3d37.990816432734675!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x14a1bd1f067043f1%3A0x2736354576668ddd!2zzpHOuM6uzr3OsQ!5e0!3m2!1sel!2sgr!4v1652863273042!5m2!1sel!2sgr" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<section class="ellenonmap">
<h1>Επικοινωνία</h1><br>
<i class="fa-solid fa-location-dot"></i><h4>Το κατάστημά μας:</h4><br>
<h4><i class="fa-solid fa-location-dot"></i>Το κατάστημά μας:</h4><br>
</section>
Solution 1:[1]
If you look at the output as zero-indexed matrix, you can note that zero occurs at index (i, j) whenever i + j is even. Using this observation, you could write the following. It is shorter but not necessarily more legible.
n = 5
result = "\n".join(
"".join("0" if (i + j) % 2 == 0 else "1" for i in range(n))
for j in range(n)
)
Solution 2:[2]
Here is a solution using itertools and a generator. Generators and itertools.cycle make it easy to repeat things without needing to count. The only trick here is to waste one element at each line in case n is even (as the last number repeats).
from itertools import cycle, islice
c = cycle(['0','1'])
n = 6
print('\n'.join(''.join(islice(c, n+1-n%2))[:n]
for _ in range(n)))
Output:
010101
101010
010101
101010
010101
101010
This makes it very easy to generalize by just changing the input:
from itertools import cycle, islice
def pattern(l, n):
c = cycle(l)
r = 1-n%len(l)
print ('\n'.join(''.join(islice(c, n+r))[:n]
for _ in range(n)))
Example:
>>> pattern(list('012'), 5)
0120
1201
2012
0120
1201
>>> pattern(list('01234'), 7)
012340
123401
234012
340123
401234
012340
123401
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | hilberts_drinking_problem |
| Solution 2 |
