如何在一行中指定相同高度的元素?

时间:2017-02-21 20:01:24

标签: css angularjs twitter-bootstrap height

我有一点引导问题。 我打印了几个带角度(ng重复)的元素,容器调整它们的高度为图像的高度..

View of my recipes

代码:

private int colorIndex = 1;
public void onChangeColor(View view) {
    int color;
    if(colorIndex==0) {
    color = Color.RED;
    colorIndex = 1;
    }else if(colorIndex==1) {
    color = Color.GREEN;
    colorIndex = 2;
    }else {
    //colorIndex = 2
    color = Color.BLUE;
    colorIndex = 0;
    }

    View layout = findViewById(R.id.layout);
    layout.setBackgroundColor(color);
    }


public class TestActivity extends AppCompatActivity {
View view;

//declare a string variable  in java a class
//private var colour = "green";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    View layout = findViewById(R.id.layout);

    layout.setBackgroundColor(Color.RED);

    view= this.getWindow().getDecorView();
    view.setBackgroundResource(R.color.gray);
}
public void goRed(View v)
{
    //if (colour == "green"){
        view.setBackgroundResource(R.color.red);
        //colour = "red";
    //}

 }
}

使用引导程序(<div class="row text-center"> <div class="col-lg-3 col-md-12 col-sm-12" ng-repeat="recipe in purchasedRecipes"> <a href="{{recipe.PdfUrl}}" target="blank"> <div class="thumbnail"> <img src="{{recipe.ImgUrl}}" alt=""/> <div class="caption"> <h3>{{recipe.RecipeName}}</h3> </div> </div> </a> </div> </div> )可以很容易地分配宽度。如何指定固定的响应高度,以便我的食谱行的行大小相同?

感谢您的帮助:)

1 个答案:

答案 0 :(得分:0)

here。前三名是:

<强> matchHeight.js

使用表格

他们给出的例子:

$0

巨大的负利润率和正面填充

他们的代码:

@media only screen and (min-width : 768px) {
    .is-table-row {
        display: table;
    }
    .is-table-row [class*="col-"] {
        float: none;
        display: table-cell;
        vertical-align: top;
    }
}