2016-07-29 28 views
0

Ich brauche einen halben oberen Kreis wie diese https://codepen.io/xram/pen/thLsk aber für einen Tag, ich kann meistens CSS zu ziehen, so kann ich nicht div hinzuzufügen. Weiß jemand, wie man es mit eine Verbindung macht.Zeichnen oberen Halbkreis für einen Tag

Das einzige Werk für div

div{ 
    height:45px; 
    width:90px; 
    border-radius: 90px 90px 0 0; 
    -moz-border-radius: 90px 90px 0 0; 
    -webkit-border-radius: 90px 90px 0 0; 
    background:green; 
    } 
+0

'a' ist ein Inline-Element, wenn Sie' display: block; 'Blockelement hinzufügen und Sie können' width' und 'height' als' div' setzen – blonfu

Antwort

2

Wollen Sie erreicht dieses

a{ 
 
    display:block; 
 
    height:45px; 
 
    width:90px; 
 
    border-radius: 90px 90px 0 0; 
 
    -moz-border-radius: 90px 90px 0 0; 
 
    -webkit-border-radius: 90px 90px 0 0; 
 
    background:green; 
 
    
 
}
<a></a>

+0

Hallo, das ist richtig, danke aber wie den Text in der Mitte platzieren, text-align: center aber es bleibt oben auf dem Kreis – pexichdu

+0

addiere ein {text-align: center; Zeilenhöhe: 45px;} –

1

Versuchen Hinzufügen Anzeige: Block zu Ihrem Anker-Tag.

<style> 
a { 
    height: 45px; 
    width: 90px; 
    border-radius: 90px 90px 0 0; 
    -moz-border-radius: 90px 90px 0 0; 
    -webkit-border-radius: 90px 90px 0 0; 
    background: green; 
    display: block; 
} 
</style> 
<body> 
<a></a> 
</body> 
2

U kann Block- oder Inline-Block-Elemente erstellen. Wie folgt aus:

a{ 
display: block; 
(or use inline-block) 
height:45px; 
width:90px; 
border-radius: 90px 90px 0 0; 
-moz-border-radius: 90px 90px 0 0; 
-webkit-border-radius: 90px 90px 0 0; 
background:green; 

}

1

div ist das Blockelement

a das Inline-Element ist

Satzelemente die Eigenschaft haben, haben, Breite, Höhe und etc. ., wenn Sie diese Stile auf ein Inline-Element anwenden, machen Sie diese Elemente als display: block and proceed.