[英]What to change in order for this to shrink?
So I wanted to make a website which is pc related.所以我想做一个与PC相关的网站。 I was into coding a few years ago, and I decided to pick it up again.
几年前我开始编码,我决定重新开始。 I came across the following problem.
我遇到了以下问题。
https://imgur.com/VjZaUEZ https://imgur.com/VjZaUEZ
If you look at this picture, you can see the part of the site which I made.如果你看这张图片,你可以看到我制作的网站的一部分。 I want it to be responsive so that the text on the left side of the picture (explanation of CPU) is shrinking when I shrink my browser.
我希望它具有响应性,以便当我缩小浏览器时,图片左侧的文本(CPU 的解释)正在缩小。
However, this is happening: https://imgur.com/LBaHlOu然而,这正在发生: https : //imgur.com/LBaHlOu
I want this text which is beneath the picture, to be next to it and shrinking.我希望图片下方的这个文字在它旁边并缩小。 After a few hours trying things with display: and margin: etc, I decided to ask you guys.
经过几个小时的尝试 display: 和 margin: 等,我决定问问你们。
Here are my codes (I know the codes aren't the best):这是我的代码(我知道代码不是最好的):
CSS : https://imgur.com/UOThxjv CSS : https : //imgur.com/UOThxjv
HTML : https://imgur.com/DAhC6dx HTML : https://imgur.com/DAhC6dx
if you need any clarification, please ask me.如果您需要任何说明,请询问我。
All the dimensions and margins in your CSS code are constant pixel lengths. CSS 代码中的所有尺寸和边距都是恒定的像素长度。
Instead, you should make them percentages of the window size.相反,您应该使它们占窗口大小的百分比。 For example, you could make the width of a div tag or an image always be
20%
of the screen size by putting in this line of CSS
to its CSS
class as shown below:例如,您可以通过将这行
CSS
放入其CSS
类,使 div 标签或图像的宽度始终为屏幕大小的20%
,如下所示:
width: 20%;
You need to set divs around h4 dynamic width to something like 60%.您需要将 h4 动态宽度周围的 div 设置为 60% 之类的东西。 Make div container for img and set its width to 40%.
为 img 制作 div 容器并将其宽度设置为 40%。 You should use parahraphs instead of heading-4 for text as well.
对于文本,您也应该使用 pararahraphs 而不是 Heading-4。
Modify HTML:修改 HTML:
<div class="text">
<p>your text</p>
</div>
<div class="img-div"><img src="pc.png" alt="pc.png" /></div>
CSS: CSS:
.text {
width: 60%;
float: left;
}
.img-div {
float: right;
width: 40%;
}
.img-div img {
width: 100%;
height: 100%;
}
Responsive image map响应式图像映射
To make the image map responsive you need to use a js script to manipulate coordinates on window resizing or use .SVG images for image map:要使图像映射具有响应性,您需要使用 js 脚本来操纵窗口大小调整时的坐标或使用 .SVG 图像作为图像映射:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.