いくつかのhtml要素の周りにボックスを入れたいと思います。しかし、このコードは個々の要素をそれぞれ引き起こします。私はボックスの外に必要な要素が他にもあるので、htmlやbody要素を使用したくありません。このCSSの問題を解決するにはどうすればよいですか?
h1, p {
width: 300px;
padding: 50px;
border: 20px solid #0088dd;
text-align: center;}
</style>
</head>
<body>
<p>this should be in the box</p>
<h1>this should be in the box</h1>
<h2> this should not be in the box</h2>
何を必要としていますか? –