Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.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左右浮动,动态宽度?_Css_Layout_Dynamic_Css Float - Fatal编程技术网

CSS左右浮动,动态宽度?

CSS左右浮动,动态宽度?,css,layout,dynamic,css-float,Css,Layout,Dynamic,Css Float,我试图得到两列并排(浮动左/右),但它们都有动态文本 ! 我试图使左侧的主文本在到达右侧类别时“打断”成一个新行(这也是动态的,所以不能是静态宽度)。仅仅使用CSS就可以做到这一点吗?还是我必须接触JS 非常感谢!:) 确保文本没有浮动,并且按钮在HTML文本的右边和前面都浮动 我们能看看代码吗?:-)我现在正忙于处理它,所以我将在几分钟内更新它。我想知道我试图实现的目标是否可能。如果我没记错的话,你应该能够通过将按钮的标记放在标题文本之前来实现你想做的。刚刚尝试过,但没有成功。也许我把它们

我试图得到两列并排(浮动左/右),但它们都有动态文本

!

我试图使左侧的主文本在到达右侧类别时“打断”成一个新行(这也是动态的,所以不能是静态宽度)。仅仅使用CSS就可以做到这一点吗?还是我必须接触JS


非常感谢!:)

确保文本没有浮动,并且按钮在HTML文本的右边和前面都浮动


我们能看看代码吗?:-)我现在正忙于处理它,所以我将在几分钟内更新它。我想知道我试图实现的目标是否可能。如果我没记错的话,你应该能够通过将按钮的标记放在标题文本之前来实现你想做的。刚刚尝试过,但没有成功。也许我把它们放错方向了。我已经用一个链接更新了这个问题,这个链接指向HTML/CSS.Perfect!你搞定了。非常感谢。:)
<div class="news-item">
    <div class="news-pic">
        <a href="#">
            <img src="" width="126" height="80" alt="">
        </a>
    </div>
    <div class="news-description">        
        <h3><a href="#">Long post title this is. What is this? this is a long post title. Even longer. (dynamic)</a></h3>   
        <a href="#" class="category-name">Longer category name (dynamic)</a>        
        <div style="clear:both"></div>
        <small><i>Published {{ post.published|date:"j. F Y" }}</i></small>
        <p class="text-min">Blah blah body</p>
        <div style="clear:both"></div>
    </div>
    <div style="clear: both"></div>
</div>
html, body {
    font-size: 13px;
    font-family: arial;
}

.news-item {
    padding: 10px 10px 10px 10px;
    border: 1px solid #f2f2f2;
    cursor: default;
    width: 658px;
    margin: 10px 0 20px 0;
    border-radius: 5px;
}

.news-pic {
    display: inline-block;
    vertical-align: top;
    padding: 3px;
    border: 1px solid #DADADA;
    margin-right: 10px;
    background: white;
}

.news-description {
    margin-left: 0;
    display: inline-block;
    width: 510px;
}

.news-description h3 {
    margin: 0;
    float: left;
    font-size: 15px;
}

.news-description h3 a {
    text-decoration: none;    
    color: #137541;
}

.category-name {
    border-top-left-radius: 3px;
    border-bottom-left-radius: 3px;
    text-decoration: none;
    padding: 1px 4px 1px 5px;
    font-weight: bold;
    border: 1px solid #dadada;
    border-right: none;
    background: rgba(215, 214, 214, .2);
    color: #807f7f;
    white-space: nowrap;
    display: inline-block;
    font-size: 10px;    
    margin-right: -11px;
    z-index: 5;
    float: right;
}