简体   繁体   English

要改变什么才能缩小?

[英]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 CSShttps : //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.

相关问题 在滚动时缩小和更改背景导航栏 - Shrink and change background navbar on scroll 在订单价格表中缩小税收和运输成本清单 - Shrink list of taxesand shipping cost in the order price list Chrome(及其他)以什么顺序加载 <img> 的? 如何改变呢? - In what order will Chrome (and others) load <img>'s? How to change this? 在javascript中更改对象数组顺序的最佳方法是什么 - What is the best way to change the order of array of objects in javascript Firefox扩展可以在启动时以什么顺序更改吗? - Can a firefox extension change in what order it is called at startup? 如果更改代码错误的顺序是什么意思? - What does it mean if change the order of code bugs occur? 谷歌地图 API 多边形内的绕组路径,带有旋转/增长/收缩/顺序选项 - Google Maps API Winding path within polygon with rotate/grow/shrink/order options 我可以更改谷歌表格中的 data.addcolumn 第一个参数,以便我能够输入字符串? - What can I change data.addcolumn first parameter in google sheets in order for me to be able to type in string? 调用 location.reload() 函数后,是什么导致表中的顺序或行发生变化 - What causes order or rows in table to change after a location.reload() function is called 将元素的顺序更改为顶部 - change the order of elements to the top
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM