给没有class的div设置样式


没有class标签,我尝试过这个方法还是不行,是不是需要修改mdx原数据?

div[xmlns|="mwref"] {
    background-color: #f0f0f0; /* 设置背景色 */
    padding: 20px; /* 设置内边距 */
    border-radius: 8px; /* 设置圆角 */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 添加阴影效果 */
    margin-bottom: 20px; /* 设置底部间距 */
    font-family: Arial, sans-serif; /* 设置字体 */
    color: #333; /* 设置文字颜色 */
    line-height: 1.6; /* 设置行高 */
    border: 2px solid #ccc; /* 添加边框 */
    position: relative; /* 设置相对定位 */
}

div[xmlns|="mwref"]::before {
    content: "Usage"; /* 添加标签内容 */
    background-color: #ccc; /* 设置标签背景色 */
    color: #fff; /* 设置标签文字颜色 */
    padding: 4px 8px; /* 设置标签内边距 */
    position: absolute; /* 设置绝对定位 */
    top: -18px; /* 设置标签位置 */
    left: 50%; /* 设置标签位置 */
    transform: translateX(-50%); /* 居中标签 */
    border-radius: 4px; /* 设置标签圆角 */
}

这样


div[xmlns\:mwref] {

}