简体   繁体   中英

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.

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; border: 0; , so that i can get the list formatted easily.

Removing padding:0; solve my query but I want to use it for my global 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{
   padding: 10px !important;
}

to make an example.

You can add a class to all list elements instead of using !important:

<ul class="list">

and add rule for .list class:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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