Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css angular加载的重复div可能有不同的内容,如何使它们自动调整高度?_Css_Angularjs - Fatal编程技术网

Css angular加载的重复div可能有不同的内容,如何使它们自动调整高度?

Css angular加载的重复div可能有不同的内容,如何使它们自动调整高度?,css,angularjs,Css,Angularjs,我的nodejs/angularjs应用程序通过angular_控制器和mongodb自动加载一堆div HTML: Angular使用模型绑定填充它们,就像这样,当有人在页面上使用表单发布模型绑定时: $scope.submit_sunti = function() { socket.emit('post_new_sunti', { content: $scope.sunti.content, tags: $scope.sunti.tags,

我的nodejs/angularjs应用程序通过angular_控制器和mongodb自动加载一堆div

HTML:

Angular使用模型绑定填充它们,就像这样,当有人在页面上使用表单发布模型绑定时:

$scope.submit_sunti = function() {
    socket.emit('post_new_sunti', {
        content: $scope.sunti.content,
        tags: $scope.sunti.tags,
        ancestor: $scope.sunti.ancestor
    })
    $scope.sunti.content = ""
    $scope.sunti.tags = ""
    $scope.sunti.ancestor = ""
}
基本上,他们最终都有相同的高度,无论什么。有人建议使用flexbox,但我对它还不太熟悉,无法理解它在这里的工作原理。Angular使用该行填充HTML

ng repeat=“sunti in suntis”
和可选的
跟踪$index
,以防两个具有相同的确切内容(不太可能,但可能)

增长是因为它清楚地包含文本,但这是否意味着我需要唯一的div id(如上面我对myslf的html注释中所示),以确保每个生成的sunti div都有其自身的适当高度

如何使角度填充的div比例适合其内容?是否可以通过CSS单独“修复”它


谢谢

您将高度硬编码为

height: 12em

这意味着您的div不会自动调整大小,只会默认为该高度

使用css flexbox。提供自动调整高度,你的意思是所有的div也将是相同的高度吗?@JoeyWood不同的高度对于不同的内容量是什么要求你的其他类的css是什么?先生你是一个国王!我对
.sunti\u contain
有双重定义,其中它有一些绝对位置。谢谢你让我再检查一遍。干得好。
$scope.submit_sunti = function() {
    socket.emit('post_new_sunti', {
        content: $scope.sunti.content,
        tags: $scope.sunti.tags,
        ancestor: $scope.sunti.ancestor
    })
    $scope.sunti.content = ""
    $scope.sunti.tags = ""
    $scope.sunti.ancestor = ""
}
.sunti_content
height: 12em