使用 CSS float 属性对齐元素
cssweb developmentfront end technology更新于 2024/4/24 7:08:17
要使用 CSS 中的 float 属性对齐元素,您可以尝试运行以下代码 −
示例
<!DOCTYPE html>
<html>
<head>
<style>
.demo {
float: right;
width: 200px;
border: 1px dashed blue;
padding: 5px;
}
</style>
</head>
<body>
<h1>Heading</h1>
<div class = "demo">
<p>This is demo text and right aligned.</p>
</div>
</body>
</html>
输出

相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

