パンくずを作る...文字通りパンくずを作るほど簡単ではありませんが、どうすればテキストを入れることができますか?

StackOverflow https://stackoverflow.com/questions/19846836

  •  29-07-2022
  •  | 
  •  

質問

そこで、私はコードからいくつかのパン粉を作りました

http://line25.com/tutorials/how-to-create-flat-style-breadcrumb-links-with-css

...そして、私はそれが好きなようにすべてを手に入れました、私の人生だけで、私は箱の中にテキストを取得する方法を理解できません...問題はそれらが別々に存在することです、私はラインを使用できます - テキストをさらにページに押し下げてさらに高くして、ネガティブな数字を使用してテキストを押し上げることはできません。

編集:link25のコードがテキスト内にあるために正常に動作することはわかっています。これは、この問題があるコンテナを縮小したためです...

何か案は?

これがHTMLです(StackOverFlowはそれを翻訳し続けます):HTML

そしてCSS:

body {
margin: 0px;
font-family: 'Roboto';
background: #eeeeee; }

Crumbs {Text-Align:Center; }

#crumbs ul {
    list-style:none;
    display: inline-table;

}

    #crumbs ul li { display: inline-block; }

        #crumbs ul li a {    /* The block part of each breadcrumb; the text in each breadcrumb */
            display: block;
            float: left;
            height: 0px;
            background: #327098;
            /*text-align: center; */
            padding: 30px 10px 0 80px;  /* size of each breadcrumb  */
            position: relative;
            margin: 0 5px 0 0;
            font-size: 16px;
            text-decoration: none;
            color: #000000; }

            #crumbs ul li a:after { /* The triangle to the right of each breadcrumb */
                content: "";
                border-top: 15px solid transparent;
                border-bottom: 15px solid transparent;
                border-left: 15px solid #327098;
                position: absolute;
                right: -15px;
                top: 0;
                z-index: 1; }

            #crumbs ul li a:before {    /* the triangle to the left of each breadcrumb  */
                content: "";
                border-top: 15px solid transparent;
                border-bottom: 15px solid transparent;
                border-left: 15px solid #eeeeee;
                position: absolute;
                left: 0;
                top: 0; }

        #crumbs ul li:first-child a {    /* what makes the first breadcrumb have a rounded left side */
            border-top-left-radius: 10px;
            border-bottom-left-radius: 10px; }

            #crumbs ul li:first-child a:before { display: none; }

        #crumbs ul li:last-child a {
            padding-right: 80px;    /* the width of the last breadcrumb */
            border-top-right-radius: 10px;  /* Makes the right side of the last breadcrumb rounded */
            border-bottom-right-radius: 10px; } /* rounded */

            #crumbs ul li:last-child a:after { display: none; }

        #crumbs ul li a:hover { background: #c9c9c9; }   /* a hover color for breadcrumbs, exclu. triangle-right    */

            #crumbs ul li a:hover:after { border-left-color: #c9c9c9; } /* a hover color for triangle-right */
役に立ちましたか?

解決

http://jsfiddle.net/zh6bw/1/

それは、パン粉が持っている高さに等しいトップパディングをアンカーに持っていることによって引き起こされます。私はそのパディングを取り外し、含有リスト要素を与えました height:30px;, 、アンカーを与えました line-height:30px; したがって、それらは垂直に中央に配置されたままです。

#crumbs ul li { 
    display: inline-block; 
    height:30px;
}

#crumbs ul li a {    /* The block part of each breadcrumb; the text in each breadcrumb */
    display: block;
    line-height:30px;
    background: #327098;
    /*text-align: center; */
    padding: 0 10px 0 80px;  /* size of each breadcrumb  */
    position: relative;
    margin: 0 5px 0 0;
    font-size: 16px;
    text-decoration: none;
    color: #000000;
}

編集

あなたが彼らが別々に存在することの意味はわかりません。提供したコードをフィドルにコピーして実行しました。そして、私は明らかな問題を見て、私ができることをしました。これが私が見た問題です。 http://jsfiddle.net/zh6bw/

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top