使用svg,您可以创建文本气泡并将linearGradient应用于它.
body {
background: #eee;
}
Great Thanks
要使文本气泡具有动态文本,您需要将三角形用作svg.文本将在svg之外.
body {
background: #eee;
}
#container {
position: relative;
display: table;
}
#text {
position: relative;
max-width: 200px;
padding: 10px;
Box-sizing: border-Box;
background: linear-gradient(to right,#fff calc(100% - 3px),#237ACB calc(100% - 3px));
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
#tri {
position: absolute;
z-index: 1;
top: calc(100% - 1px);
right: 0;
}
max-width
(200px) and height to contain the dynamic text
应用Box-shadow:
要向svg添加Box-shadow,您必须在路径上应用svg过滤器.通过CSS执行它将无法工作,因为CSS无法查看实际路径.
feFuncA元素的slope属性控制阴影的不透明度,feOffset是自解释的.
body {
background: #eee;
}
#container {
position: relative;
display: table;
}
#text {
width: auto;
max-width: 66%;
padding: 12px 30px;
Box-sizing: border-Box;
background: #ffffff;
Box-shadow: 0 2px 0 2px rgba(177,.1);
margin: 4px 0 0 0;
position: relative;
float: right;
border-right: 5px solid #0892cb;
border-radius: 5px 0 0 5px;
}
#tri {
position: absolute;
z-index: 1;
top: calc(100% - 1px);
right: 0;
}
max-width
(200px) and height to contain the dynamic text
重用svg:
要多次使用相同的svg路径,可以在defs元素中定义path元素,并使用use元素多次使用它,如下例所示.
body {
background: #eee;
}
.containerIn,.containerOut {
position: relative;
display: table;
margin: 4px 0 15px;
}
.text {
width: auto;
max-width: 66%;
padding: 12px 30px;
Box-sizing: border-Box;
background: #ffffff;
Box-shadow: 0 2px 0 2px rgba(177,.1);
margin: 4px 0 0 0;
position: relative;
float: right;
border-right: 5px solid #0892cb;
border-radius: 5px 0 0 5px;
}
.containerIn .text {
border: 0;
border-left: 5px solid #689F38;
border-radius: 0 5px 5px 0;
float: left;
}
.tri {
position: absolute;
z-index: 1;
top: calc(100% - 1px);
right: 0;
}
.containerIn .tri {
left: 0;
}
max-width
(200px) and height to contain the dynamic text
max-width
(200px) and height to contain the dynamic text
max-width
(200px) and height to contain the dynamic text
max-width
(200px) and height to contain the dynamic text