Responsiveness not working at certain condition only.

huangapple go评论76阅读模式
英文:

Responsiveness not working at certain condition only

问题

所以我正在尝试制作我的网站,但它无法正常工作。实际上,只有可见性起作用,但尺寸和其他东西不起作用。我仍然在学习中。
这是我的网站链接,有一张图片对可见性:hidden;起作用,但宽度、高度不起作用。
对于文本部分也是一样的。我无法更改文本部分的宽度。
以下是我的代码,
这些元素的HTML在这里,

<div class="mainContent">
    <img src="BgImg.png" alt="" srcset="">
</div>
<div class="textContent">
    <p>
        Lorem Ipsum....
    </p>
</div>

@media (max-width: 768px) {
.mainContent img {
margin-left: 100px;
}
.textContent {
width: 100px;
font-size: 15px;
}
}

我尚未将此代码发布到网站上,但在本地它不起作用。
我在我的代码中也使用了 <meta name="viewport" content="width=device-width, initial-scale=1.0">。感谢您的帮助。

英文:

So I am trying to make my site it's not working properly. Infact only visibility is working but sizes and other stuffs doesn't work. I am still learning stuffs.
www.ditikrimal.com.np
Here is my site link and there is image which responses for the visibility:hidden; but doesn't work with width, height.
Same goes for that text section. I can't change that text section's width.
Below is my code,
Html for these elements are here,

  &lt;div class=&quot;mainContent&quot;&gt;
        &lt;img src=&quot;BgImg.png&quot; alt=&quot;&quot; srcset=&quot;&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;textContent&quot;&gt;
        &lt;p&gt;
            Lorem Ipsum....
        &lt;/p&gt;
    &lt;/div&gt;

@media (max-width: 768px) {

.mainContent img{
 margin-left:100px;
 }
.textContent{
width: 100px;
font-size: 15px;
}

}

I haven't published this code to the site but locally it doesn't work.
I have used &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt; in my code too. Thank you for your help.

答案1

得分: 0

Amaury Hanser 正如所说。

浏览器逐行读取您的 CSS,请查看下面的屏幕截图。

英文:

As Amaury Hanser said right.

Browser read your CSS line by line, Check below screen shot.

Responsiveness not working at certain condition only.

huangapple
  • 本文由 发表于 2023年7月6日 15:58:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/76626682.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定