【问题标题】:How can I integrate in html pages 2 different CSS styles for 2 diferent images? [closed]如何在 html 页面中为 2 个不同的图像集成 2 个不同的 CSS 样式? [关闭]
【发布时间】:2022-02-15 17:13:17
【问题描述】:

谁能帮帮我?

如何在 html 页面中为 2 个不同的图像集成 2 个不同的 CSS 样式,两者都由一个空格垂直分隔?

请看下面的画。它们有不同的尺寸,不同的风格。

【问题讨论】:

  • 对图像应用不同的类,使用nth-childnth-of-type 选择器。您遇到的问题是什么?
  • 你能告诉我html/css代码作为答案吗?我不明白你的意思..

标签: html css dreamweaver


【解决方案1】:

类似的东西。您可以随时更改尺寸

.img, .firstImage, .secondImage {
    border: 1px dotted blue;
    width: 200px;
}

.firstImage {
    float:left;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
    width: 150px;
}

.secondImage {
    float:right;
    border: 2px solid #fff;
    border-radius: 2px;
    padding: 3px;
    width: 120px;
}

【讨论】:

    【解决方案2】:

    朋友给我写了这段代码,很好的回答:

    HTML

    <div id="img1"><img src=logo.png"></div>
    <div id="img2"><img src=logo2.png"></div>
    

    CSS

    #img1{border-style :solid;
    border-color:red;}
    
    #img2{border-style :solid;
    border-color:blue;
    margin-top:20px;}
    

    来源:HERE

    【讨论】:

      猜你喜欢
      • 2017-09-22
      • 1970-01-01
      • 2013-12-19
      • 2014-07-29
      • 1970-01-01
      • 2016-11-10
      • 1970-01-01
      • 2011-12-20
      • 1970-01-01
      相关资源
      最近更新 更多