gpt4 book ai didi

html - 有没有办法让这个 HTML 和 CSS 在 Teachable 页面上工作?

转载 作者:行者123 更新时间:2023-11-28 19:24:32 24 4
gpt4 key购买 nike

所以我在一个名为 Teachable 的平台上使用 HTML 和 CSS 时遇到了一些困难。

基本上,我正在尝试制作 2 列:- 第 1 列 - 图片- 第 2 列 - 文本

当我输入 <div class="column">只有在第 1 列我得到这个:

Layout 1

当我输入 <div class="column">在这两个部分,我得到了您在这里看到的内容。

Layout 2

如您所见,在这种情况下,第 2 列变得非常狭窄。是否可以使第 1 列的宽度约为 25%,而第 2 列的宽度约为 75%?

这是我正在使用的 css 代码:

/* Three image containers (use 25% for four, and 50% for two, etc) */
.column {
float: left;
width: 33.33%;
padding: 5px;
}

/* Clear floats after image containers */
.row::after {
content: "";
clear: both;
display: table;
}

最佳答案

/*created separate classes for div sections of img and text*/
/*column-1 is img div*/
.column-1 {
float: left;
width: 25%;
height: 100%;
padding: 5px;
}

/*img must be set to 100% width to fill div container*/
img {
width: 100%;
}

/*column-2 is text div*/
.column-2 {
width: 75%;
padding: 5px;
}
/*Change padding and width to fit your needs.*/
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="column-1">
<img src="SS_img_01-2-s.jpg">
</div>
<div class="column-2">
<p>
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
As you can see, column 2 becomes very narrow in this case.
</p>
</body>
</html>

这就是我认为您想要达到的目的,但是,我可能是错的。

编辑: 好的,所以您可以将“高度:100%”添加到第 1 列,除非您想在 img 下方包含内容,但如果它只是 img 和文本,那么它应该没问题。如果您确实需要在 img 下方添加内容,我认为使用 z-index 并以正确的方式定位元素应该可行。希望这就是您要找的。此外,由于某种原因,代码片段没有显示我在其上运行代码时得到的结果,因此请务必自行检查它是否有效。

关于html - 有没有办法让这个 HTML 和 CSS 在 Teachable 页面上工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56550485/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com