开发者

CSS - Creating a button the height of an entire column

Is it possible to create a button that stretches the height of a neighboring table column? Is it possible to stretch the button if it were an image?

I'll try to describe what I'm trying to do in layout below - one of the columns is simply a button, the other contains text and other data.

______   ______
|    |   |    |
|    |   |    |
|    |   |    |
|    |   |   开发者_开发百科 |
|    |   |    |
______   ______


It is possible to create a button that stretches the height of the neighboring column with CSS only, but you need to put both of them inside of a parent <div>. Then you add display: flex

.mainContainer{
  display: flex;
}

.content{
  height: 200px;
  width:100px;
  border: 1px solid black;
}
<div class="mainContainer">
  <div class="content">
   This has content
  </div>
  <button>Button</button>
</div>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜