html - 图片填写所有col

标签 html css

我现在真的得想办法了。我希望一张图片填满我的 col-6。但是我怎么知道图片的尺寸应该有多大呢?我也应该设置一个高度吗?

<div class="row">
        <div class="col col-6">
            <img src="img/fly_tying.jpg">
        </div>
        <div class="col col-6">
            <form action="flyUpload.php">
                <fieldset>
                    <legend>Upluad Fly</legend>
                    <label for="name">Name</label>
                    <input type="text" id="name" value="name"><br>
                    <label for="category">Category</label>
                    <input type="text" id="category" value="category"><br>
                    <label for="fishtype">Fishtype<label>
                    <input type="text" id="fishtype" value="fishtype"><br>
                    <button type="submit" value="submitFly">Submit My Fly</button>
                </fieldset>
            </form>
        </div>
</div>

CSS:

.col-6{
  width:50%;
}

最佳答案

高度只是设置自动。并使 img 设置宽度 100%

关于html - 图片填写所有col,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36682932/

相关文章:

html - float 和边距顶部

javascript - 如何在不改变宽度/高度的情况下垂直和水平对齐 DIV 中的图像?

javascript - 带图像的 HTML/CSS 模态对话框(Sweetalert 或其他)

javascript - 来自 CDN 的 Css 或 Javascript

javascript - 从 iframe 中抓取父页面 html

javascript - jQuery Mobile 中的文本区域高度和宽度?

html - 彼此相邻的 float div

javascript - 将输入文本从 3 个字段传递到 JavaScript 并发送

css - Flexbox 在 Safari 中仍然不稳定,flex-wrap 不起作用

css - 从 bootstrap.css 创建非响应式 CSS