保证金不起作用。任何人检查我的代码并帮助我?

问题描述 投票:0回答:2

我希望对齐div中心内的所有div。所以我给外部div提供保证金但是保证金不起作用。我不知道是什么问题。我给宽度也是...给浮动是问题我读到边距有漂浮和宽度问题。这是问题吗?

* {
  margin: 0px;
  padding: 0px;
}

#products_main {
  clear: both;
  margin: 50px:;
}

.product_item {
  clear: both;
}

.product_item_image {
  float: left;
}

.product_item_content {
  float: left;
  width: 65%;
  font-size: 200%;
  align: justify;
}

.product_item_heading {
  width: 75%;
  color: #06F;
}
<body>
  <div id="products_main">
    <div id="products">
      <div class="product_item">
        <div>
          <h2 class="product_item_heading">
            Industrial Automation
          </h2>
        </div>
        <div class="product_item_image">
          <img src="images/products/Industrial automation/images/Oscillator.jpg" width="350" height="200">
        </div>
        <div class="product_item_content">
          Oscillators:Quartz crystal Oscillators,crystal resonators,Oscillator modules
        </div>
      </div>
    </div>
  </div>
</body>
html css
2个回答
0
投票

只需在: 50px之后移除结肠margin:50px: ;就可以了!


-1
投票

你的CSS错了。从:删除50px

*
{
    margin: 0px;
    padding: 0px;
}
#products_main
{
    clear:both;
    margin:50px ;
}
.product_item
{
    clear: both;
}
.product_item_image
{
    float: left;
}
.product_item_content
{
    float: left;
    width:65%;
    font-size:200%;
    text-align:justify;
}
.product_item_heading
{
    width:75%;
    color:#06F;
}
<div id="products_main">
    <div id="products">
        <div class="product_item">
            <div>
                <h2 class="product_item_heading">
                    Industrial Automation
                </h2>
            </div>
            <div class="product_item_image">
                <img src="images/products/Industrial automation/images/Oscillator.jpg" width="350" height="200">
            </div>
            <div class="product_item_content">
                Oscillators:Quartz crystal Oscillators,crystal resonators,Oscillator modules for defence &  Space applications will be supplied with  custom-made.Oscillators like  TCXO,VCXO,OCXO  etc.
            </div>
        </div>
    </div>
</div>
© www.soinside.com 2019 - 2024. All rights reserved.