出于某些原因,我有一个" lime" " top"之间的彩色1px
线以及" bod"。当我删除overflow
css指令时,该行就会消失。
我只能看到" lime"在Chrome中排队,而不在Firefox中。
以下是代码:https://jsfiddle.net/m36yk1o9/5/
#chatApplicationClassic {
padding: 0;
margin: 0;
border: 0;
position: fixed;
bottom: 0px;
right: 30px;
width: 300px;
background-color: lime;
box-sizing: border-box;
border-radius: 5px 5px 0 0;
box-shadow: 0px 0px 5px #000000;
}
#chatHeaderClassic {
padding: 0;
margin: 0;
border: 0;
width: 100%;
background-color: pink;
cursor: pointer;
border-radius: 5px 5px 0 0;
border-top: 0px solid red;
border-left: 0px solid red;
border-right: 0px solid red;
border-bottom: 0px solid red;
box-sizing: border-box;
}
#chatHeaderTextClassic {
padding: 0;
margin: 0;
border: 0;
color: #ffff33;
font-family: 'Open Sans', sans-serif;
padding: 6px;
font-size: 18px;
font-weight: 100;
display: inline-block;
border-radius: 5px 5px 0 0;
}
#chatHeaderArrowClassic {
padding: 0;
margin: 0;
border: 0;
color: #9900ff;
display: inline-block;
float: right;
padding: 6px;
font-size: 18px;
}
#chatBodyClassic {
padding: 0;
margin: 0;
border: 0;
background-color: white;
border-left: 5px solid pink;
border-right: 5px solid pink;
height: 200px;
width: 100%;
box-sizing: border-box;
padding-top: 10px;
overflow: scroll;
}
.chatAgentBubbleClassic {
padding: 0;
margin: 0;
border: 0;
background-color: #664eff;
margin-right: 40px;
margin-top: 10px;
box-sizing: border-box;
border-radius: 4px;
}
.chatVisitorBubbleClassic {
padding: 0;
margin: 0;
border: 0;
background-color: #6600ff;
margin-left: 40px;
margin-top: 10px;
box-sizing: border-box;
border-radius: 4px;
}
.chatAgentBubbleTextClassic {
font-size: 12px;
padding: 8px;
font-family: sans-serif;
color: lightblue;
}
.chatVisitorBubbleTextClassic {
font-size: 12px;
padding: 6px;
font-family: sans-serif;
color: skyblue;
}

<div id="chatApplicationClassic">
<div id="chatHeaderClassic">
<div id="chatHeaderArrowClassic">
Arr
</div>
<div id="chatHeaderTextClassic">
Top
</div>
</div>
<div id="chatBodyClassic">
bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br />
</div>
<!--
<div id="chatFooterClassic">
<div id="chatInputContainerClassic">
<input placeholder="type here..." id="chatInputClassic" type="text" />
</div>
<div id="chatSendButton">
<div id="chatSendButtonText">Send</div>
</div>
</div>-->
</div>
&#13;
答案 0 :(得分:1)
将填充从6px更改为5px:
#chatHeaderArrowClassic {
padding:0;
margin:0;
border:0;
color:#9900ff;
display:inline-block;
float:right;
padding:5px;
font-size:18px;
}
答案 1 :(得分:1)
它可能来自标题中的两个子元素。 padding
使其中一个容器高于容器,其中设置了float
导致溢出,因为您没有在那里设置任何clearfix。
但是,由于您将float:right
设置为“Top”,只需在“Arr”上设置float:left
,并通过在容器上添加overflow:hidden
来清除浮动。那条细石灰线将被移除。
<强> Updated jsFiddle 强>
#chatApplicationClassic {
padding: 0;
margin: 0;
border: 0;
position: fixed;
bottom: 0px;
right: 30px;
width: 300px;
background-color: lime;
box-sizing: border-box;
border-radius: 5px 5px 0 0;
box-shadow: 0px 0px 5px #000000;
}
#chatHeaderClassic {
padding: 0;
margin: 0;
border: 0;
width: 100%;
background-color: pink;
cursor: pointer;
border-radius: 5px 5px 0 0;
border-top: 0px solid red;
border-left: 0px solid red;
border-right: 0px solid red;
border-bottom: 0px solid red;
box-sizing: border-box;
overflow: hidden; /*added*/
}
#chatHeaderTextClassic {
padding: 0;
margin: 0;
border: 0;
color: #ffff33;
font-family: 'Open Sans', sans-serif;
padding: 6px;
font-size: 18px;
font-weight: 100;
/* display: inline-block; */
border-radius: 5px 5px 0 0;
float: left; /*added*/
}
#chatHeaderArrowClassic {
padding: 0;
margin: 0;
border: 0;
color: #9900ff;
/* display: inline-block; */
float: right;
padding: 6px;
font-size: 18px;
}
#chatBodyClassic {
padding: 0;
margin: 0;
border: 0;
background-color: white;
border-left: 5px solid pink;
border-right: 5px solid pink;
height: 200px;
width: 100%;
box-sizing: border-box;
padding-top: 10px;
overflow: scroll;
}
.chatAgentBubbleClassic {
padding: 0;
margin: 0;
border: 0;
background-color: #664eff;
margin-right: 40px;
margin-top: 10px;
box-sizing: border-box;
border-radius: 4px;
}
.chatVisitorBubbleClassic {
padding: 0;
margin: 0;
border: 0;
background-color: #6600ff;
margin-left: 40px;
margin-top: 10px;
box-sizing: border-box;
border-radius: 4px;
}
.chatAgentBubbleTextClassic {
font-size: 12px;
padding: 8px;
font-family: sans-serif;
color: lightblue;
}
.chatVisitorBubbleTextClassic {
font-size: 12px;
padding: 6px;
font-family: sans-serif;
color: skyblue;
}
<div id="chatApplicationClassic">
<div id="chatHeaderClassic">
<div id="chatHeaderArrowClassic">
Arr
</div>
<div id="chatHeaderTextClassic">
Top
</div>
</div>
<div id="chatBodyClassic">
bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br /> bod
<br />
</div>
<!--
<div id="chatFooterClassic">
<div id="chatInputContainerClassic">
<input placeholder="type here..." id="chatInputClassic" type="text" />
</div>
<div id="chatSendButton">
<div id="chatSendButtonText">Send</div>
</div>
</div>-->
</div>
答案 2 :(得分:0)
您好,
看起来父元素的背景颜色为石灰,如果你隐藏#chatHeaderClassic背景色,它会显示出来.Proof:
var myApp = angular.module('myApp', []);
function MyCtrl($scope) {
$scope.name = 'Angular Directive';
$scope.osList = "Original value";
$scope.stuffFromController = {};
$scope.myFunc = function(){ alert("Function in controller");};
};
var HelloDirective = function() {
return {
scope: {
list: "=",
func: "&"
}, // use a new isolated scope
restrict: 'AE',
replace: false,
template: '<h3>{{list}}</h3><button ng-click="func()" type="button">Button</button>',
link: function(scope, elem, attrs) {
}
};
};
myApp.directive("helloDirective", HelloDirective);
}
所以只需将上面的代码更改为:
#chatApplicationClassic {
padding: 0;
margin: 0;
border: 0;
position: fixed;
bottom: 0px;
right: 30px;
width: 300px;
background-color: lime;
box-sizing: border-box;
border-radius: 5px 5px 0 0;
box-shadow: 0px 0px 5px #000000;
}
希望这会有所帮助。 此致