2

私のウェブサイトで吹き出しを作りたいのですが、そのための素晴らしいチュートリアルを見つけました。しかし、私はいくつかの変更を行いたいのですが、方法がわかりません。基本的に、小さな三角形を水平に反転させたいので、左側ではなく右側に垂直になります。CSSは次のとおりです。

.bubble
{
    margin-top: 100px;
    position: relative;
    width: 200px;
    height: 100px;
    text-align: center;
    line-height: 100px;
    background-color: #fff;
    border: 8px solid #666;
    -webkit-border-radius: 30px;
    -moz-border-radius: 30px;
    border-radius: 30px;
    -webkit-box-shadow: 2px 2px 4px #888;
    -moz-box-shadow: 2px 2px 4px #888;
    box-shadow: 2px 2px 4px #888;
}


.bubble:after
{
    content: ' ';
    position: absolute;
    width: 0;
    height: 0;
    left: 38px;
    top: 100px;
    border: 15px solid;
    border-color: #fff transparent transparent #fff;
}
4

3 に答える 3

3

cssの下で試してください:

.bubble:after {
    -moz-border-bottom-colors: none;
    -moz-border-image: none;
    -moz-border-left-colors: none;
    -moz-border-right-colors: none;
    -moz-border-top-colors: none;
    border-color: orange orange transparent transparent; // See here i change the color
    border-style: solid;
    border-width: 15px;
    content: " ";
    height: 0;
    position: absolute;
    right: 38px; // see here for position
    top: 100px;
    width: 0;
}

.bubble:before {
    border: 25px solid;
    content: " ";
    height: 0;
    position: absolute;
    right: 30px; // see here for position
    top: 100px;
    width: 0;
}
于 2013-01-05T04:36:02.637 に答える
2

これが動作していることを示すjsFiddleですPure CSS Bubblesから参照

CSS

.bubble {
    margin-top: 100px;
    position: relative;
    width: 200px;
    height: 100px;
    text-align: center;
    line-height: 100px;
    background-color: orange;
    -webkit-border-radius: 30px;
    -moz-border-radius: 30px;
    border-radius: 30px;
}

.bubble:after {
    content:"";
    position:absolute;
    bottom:-20px; 
    left:50px; 
    border-width:20px 0 0 20px; 
    border-style:solid;
    border-color: orange transparent;
    display:block; 
    width:0;
}

HTML

    <div class="bubble">
        nice
    </div>
于 2013-01-05T04:40:03.200 に答える
0

今のところ、要素を反転して修正しました。それを行う正しい方法である別の方法はありますか?

-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1); 
于 2013-01-05T04:36:27.747 に答える