Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将一组属性视为一个属性html?_Html_Css - Fatal编程技术网

如何将一组属性视为一个属性html?

如何将一组属性视为一个属性html?,html,css,Html,Css,我试图为我的站点的某个部分设置一个边距,但它有多个属性,并且它分别处理每一个属性,是否有任何方法可以将其视为一个属性。下面是我的例子: <div style="background-color: grey; padding: 13px;"> <h1>This part of the site is the menu, this part should be unaffected</h1> </div> <div style="floa

我试图为我的站点的某个部分设置一个边距,但它有多个属性,并且它分别处理每一个属性,是否有任何方法可以将其视为一个属性。下面是我的例子:

<div style="background-color: grey; padding: 13px;">
    <h1>This part of the site is the menu, this part should be unaffected</h1>
</div>
<div style="float: right;">
    <h1>This part should be closer to the left side</h1>
</div>
<h1>This part should be closer to the right side</h1>

网站的这部分是菜单,这部分应该不受影响
这部分应该更靠近左侧
这部分应该更靠近右侧
我希望每一方都靠得更近,但似乎不起作用。

风格:

.flex{display:flex;justify content:space around}
html:

站点的这部分是菜单,这部分应该不受影响
这部分应该更靠近左侧
这部分应该更靠近右侧

以下是html格式的示例:请澄清您的具体问题或添加其他详细信息,以突出显示您所需的内容。正如目前所写的,很难说清楚你在问什么。使用float right,你将第二个div定位在页面的右侧,而不是左侧。你想做什么?请你解释一下