html插入自定义样式
html_bf = BeautifulSoup(html, features='html.parser')
style = html_bf.find("style")
new_style = html_bf.new_tag("style")
new_style.append(
"table tbody{display:block;height:400px;overflow-y:auto;-webkit-overflow-scrolling:touch;}table thead,tbody tr{display:table;width:100%;table-layout:fixed;background-color:CadetBlue;font-size:10px}table thead{width:calc(100%-1em)}table thead th{background-color: LightSalmon}")
style.insert_after(new_style)
divs = html_bf.select('.chart-container')
divs[1][
"style"] = "width:900px;height:500px;position:absolute;top:30px;left:922px;border-style:dashed;border-width" \
":1px; "
divs[3][
"style"] = "width:900px;height:500px;position:absolute;top:576px;left:923px;border-style:dashed;border-width" \
":1px; "
html插入自定义样式
最新推荐文章于 2024-08-08 07:25:39 发布