我希望对齐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>
只需在:
50px之后移除结肠margin:50px: ;
就可以了!
你的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>