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

时间:2022-12-06 20:26:38

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

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.

那么如何覆盖边距:0;填充:0;边界:0; ,以便我可以轻松地格式化列表。

Removing padding:0; solve my query but I want to use it for my global CSS

删除填充:0;解决我的查询,但我想将它用于我的全局CSS

2 个解决方案

#1


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.

举个例子。

#2


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;
}

#1


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.

举个例子。

#2


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;
}