2
In meiner Cordova-basierten App habe ich ein div, das eine grafische Darstellung eines britischen Nummernschildes zeigen soll. DieseAbsolut positioniertes Element nicht richtig ausgerichtet innerhalb relativer div
ist, wie es soll aussehen:
(wie es zeigt auf iOS - Cordova ver 3.8)
jedoch auf Android, Cordova ver 4.1.1 scheint es, wie Sie stattdessen:
Das snippet ist wie folgt, um das Problem zu demonstrieren. Jede Hilfe würde sehr geschätzt werden.
.registration-plate-container {
text-align: center;
}
.registration-plate-ui {
background: linear-gradient(to bottom, #f8d038 0%, #f5ca2e 100%);
padding: .25em 1em .25em 1.75em;
font-weight: bold;
font-size: 2em;
border-radius: 5px;
border: 1px solid #000;
box-shadow: 1px 1px 1px #ddd;
position: relative;
font-family: helvetica, ariel, sans-serif;
}
.registration-plate-ui:before {
content: 'GB';
display: block;
width: 30px;
height: 100%;
background: #063298;
position: absolute;
top: 0;
border-radius: 5px 0 0 5px;
color: #f8d038;
font-size: .5em;
line-height: 85px;
padding-left: 5px;
}
.registration-plate-ui:after {
content: '';
display: block;
position: absolute;
top: 7px;
left: 5px;
width: 20px;
height: 20px;
border-radius: 30px;
border: 1px dashed #f8d038;
}
<div class='registration-plate-container'><span class='registration-plate-ui'>AB12 CDE</span></div>
Dies behebt die Positionierung des vor Element überlappt es jedoch den Inhalt, darunter ist - wie kann ich dieses Problem beheben? – Ryan
@Ryan Ändern Sie die Z-Position von div .. Wenn ich verstehe, was Sie fragen –
Wenn Sie darunter auf der Y-Achse bedeuten, müssen Sie eine Höhe für den Container festlegen. Ich habe meine Antwort aktualisiert. –