gpt4 book ai didi

css - 为什么 form-inline 的元素之间没有空格?

转载 作者:行者123 更新时间:2023-11-28 10:54:28 25 4
gpt4 key购买 nike

演示:http://jsfiddle.net/sunnycpp/MPACc/4/

相同的代码复制粘贴在这里:HTML

<div class="container">
<debug-bar ng-controller="parentController">
<debug-bar ng-controller="childController">
<debug-bar ng-controller="oneMoreChildController"></debug-bar>
</debug-bar>
<debug-bar ng-controller="oneMoreChildController"></debug-bar>
</debug-bar>
</div>

Javascript

var angModule = angular.module('components', []);
angModule.directive('debugBar', function () {
return {
restrict: 'E',
template:
'<div>'+
'<form class="form-inline">' +
'<input type="text" class="input-small" ng-model="myText"/>' +
'<button class="btn btn-primary">Broadcast</button>' +
'<button class="btn btn-primary">Emit</button>' +
'</form>' +
'<div ng-transclude></div>'+
'</div>',
transclude: true,
replace: true
};
});


function createController(myText) {
return function ($scope) {
$scope.myText = myText;
$scope.$on("event", function (senderText) {
console.log("Event received in:" + $scope.myText + " from Sender:" + senderText);
});
$scope.$broadCastEvent = function () {
$scope.$broadcast("event", $scope.myText);
console.log("Sent event from:" + $scope.myText);
};
};
}

angModule.controller("parentController", createController("In parent"));

angModule.controller("childController", createController("in FirstChild"));

angModule.controller("oneMoreChildController", createController("in oneMoreChildController"));
angModule.controller("oneMoreChildController", createController("in secondLevelChild"));

最佳答案

因为你没有定义任何东西。 :p jsfiddle 和 bootstrap 重置边距,你没有定义任何...

定义一些边距可以立即解决问题

input,button{
margin:0 5px;
}

Example

关于css - 为什么 form-inline 的元素之间没有空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14394795/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com