简体   繁体   English

我如何覆盖保证金:0; 填充:0; 边界:0; 来自主体css的css样式为ul li

[英]How can i override the margin: 0; padding: 0; border: 0; css styles from main body css for ul li

I was creating a ul li list, but my issue is that list is not working because it calls some other css. 我正在创建一个ul li列表,但我的问题是列表无效,因为它调用了其他一些css。

jsFiddle 的jsfiddle

 body, div, span, ul, li, input, a, p, h1, h2, h3, h4, h5, img, table, tr, th, td { border: 0 none; box-sizing: border-box; margin: 0; outline: 0 none; padding: 0; } 
 <ul id="" class=""> <li><p>Laparoscopic Surgery</p></li> <ul> <li>Hernia</li> <ul> <li>Inguinal</li> <li>Femoral</li> <li>Incisional</li> <li>Hiatal</li> <li>Umbilical</li> </ul> <li>Cholecystectomy (Gallbladder removal)</li> <li>Lysis of Adhesion</li> <li>Appendectomy</li> <li>Ectopic Pregnancy</li> <li>Myomectomy (removal of tumor (usually fibroid) in uterus)</li> <li>Oopherectomy / Salpingectomy ( Ovary/ Fallopian tubes)</li> <li>Ovarian Cyst (Resection / cystectomy)</li> <li>Splenectomy (spleen)</li> <li>Tubal Ligation</li> </ul> <li>• Thyroidectomy (thyroid)</li> <li>• Abdominal Surgery</li> <li>o Open vs. Laparoscopic</li> <li>? Splenectomy</li> <li>? Appendectomy</li> <li>• Septoplasty - Tonsil & Adenoid</li> <li>• Rhinoplasty (nose)</li> <li>• Vein Ligation and stripping (varicose or esophageal)</li> <li>• Insertion of Pacemaker</li> <li>• Cesarean Section</li> <li>• Hysterectomy – abdominal or vaginal</li> <li>• D & C ( Dilitation & Curettage, possible miscarriage)</li> <li>• I & D – skin /subcutaneous abscess or cyst (Incision & Drainage)</li> <li>• Cataract Extraction</li> <li>• Retinal Detachment</li> </ul> 

So how can i override the margin: 0;padding: 0; 那么如何覆盖边距:0;填充:0; border: 0; 边界:0; , so that i can get the list formatted easily. ,以便我可以轻松地格式化列表。

Removing padding:0; 删除padding:0; solve my query but I want to use it for my global CSS 解决我的查询,但我想将它用于我的全局CSS

Either remove ul and li from the global declaration or add "!important" to the new declaration to be sure that the previous rule is not considered; 从全局声明中删除ul和li,或者在新声明中添加“!important”以确保不考虑先前的规则;

ul{
   padding: 10px !important;
}

to make an example. 举个例子。

You can add a class to all list elements instead of using !important: 您可以向所有列表元素添加一个类,而不是使用!important:

<ul class="list">

and add rule for .list class: 并为.list类添加规则:

.list {
    margin: 10px 0 10px 20px;
    list-style: none;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM