我想把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>
&#13;
答案 0 :(得分:0)
只需在:
中50px之后删除冒号margin:50px: ;
,它就会起作用!
答案 1 :(得分:-1)
你的CSS错了。从testrpc
:
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;
}