Create custom HTML div which has 6 angles instead of 4 angles(创建具有 6 个角度而不是 4 个角度的自定义 HTML div)
问题描述
我想创建一个特殊的 HTML div,它有 6 个角度而不是 4 个角度.我希望 6 角 div 的文本内容相应地调整形状.有什么办法可以做到这一点?我想使用 2 个(未嵌套)div 元素(或可能的其他 HTML 块元素).
I want to create a special HTML div which has 6 angles instead of 4 angles. I want text content of 6 angled div adjust to shape accordingly. Is there any way to achieve this? I want to use 2 (NOT NESTED) div elements (or possible other HTML block elements).
推荐答案
float 就是为此而生的.
float is made for this.
.box {
width:400px;
padding:20px;
border:2px solid;
background:lightblue;
clip-path:polygon(82px 0,100% 0,100% 100%,0 100%,0 82px,82px 82px); /* hide the float part*/
}
.box::before {
content:"";
float:left;
width:80px;
height:80px;
margin:-20px 20px 20px -20px;
border-right:2px solid;
border-bottom:2px solid;
}
<div class="box">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce id urna eu augue posuere euismod lobortis sed sem. Etiam sed enim nec augue ultrices ultrices vestibulum in justo. Nunc nec euismod urna. In tincidunt, magna molestie elementum venenatis, enim tortor consequat leo, nec ullamcorper purus lorem at ante. In tincidunt, magna molestie elementum venenatis, enim tortor consequat leo, nec ullamcorper purus lorem at In tincidunt, magna molestie elementum venenatis, enim tortor consequat leo, nec ullamcorper purus lorem at
</div>
这篇关于创建具有 6 个角度而不是 4 个角度的自定义 HTML div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:创建具有 6 个角度而不是 4 个角度的自定义 HTML div


- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01