Home > Software design >  Unable to create an unordered list with <ul> with my linked CSS stylesheet
Unable to create an unordered list with <ul> with my linked CSS stylesheet

Time:02-03

I can only create an unordered list with <u1> ("you one") and not <ul> ("you el") when I reference any html document in its <head> with my css stylesheet this way:

<link rel="stylesheet" type="text/css" href="./css/default.css" />

Every other css design modification works, except I lose the ability to make unordered lists with <ul>.

<!DOCTYPE html>

<html>

<head>
    <meta charset="UTF-8">
    <title>Home</title>
    <link rel="stylesheet" type="text/css" href="./css/default.css" />
</head>

<body>
    <!--This doesnt work-->
    <ul>
        <li>Item 1</li>
        <li>Item 2</li>
    </ul>

    <!--But somehow this does-->
    <u1>
        <li>Item 1</li>
        <li>Item 2</li>
    </u1>

</body>

</html>

Result: result

Edited with HTML and result

Below is my CSS stylesheet, is there anything funny going on in it? Thanks!

* {
    margin: 0;
    padding: 0;
    font-family: verdana,arial; 
}

body {
    display: block;
    width: 99%;
    margin: 0.5% 0.5% 0.5% 0.5%;
}

p {
    padding: 5px 0px 5px 0px;
}

table {
    border-style: solid; 
    border-width: 1px;
    font-size: smaller;
}

th, td {
    border-style: solid; 
    border-width: 1px;
    border-spacing: 1px;
    padding: 3px;
}

a {
    text-decoration-line: none; 
}

a:hover {
    text-decoration-line: underline;
    cursor: hand;
}

.header {
    display: block;
    padding: 3px 3px 3px 3px;
    clear: both;
    background-color: whitesmoke;
}

.loginbox {
    display:block;
    text-align: right;
    padding: 3px 3px 3px 3px;
}

.mainmenu {
    display: block;
    width: 15%;
    margin: 0.5% 0% 0.5% 0%;
    padding: 3px 3px 3px 3px;
    float: left;
    background-color: whitesmoke;
}

.content {
    display: block;
    width: 67.5%;
    margin: 0.5% 0.5% 0.5% 0.5%;
    padding: 3px 3px 3px 3px;
    float: left;
}

.sidebar {
    display: block;
    width: 15%;
    margin: 0.5% 0% 0.5% 0%;
    padding: 3px 3px 3px 3px;
    float: right;
    background-color: silver;
    text-align: center;
}

.footer {
    display: block;
    margin: 0.5% 0% 0% 0%;
    padding: 3px 3px 3px 3px;
    clear: both;
    background-color: whitesmoke;
}

.advertisement {
    margin: 5px 0px 5px 0px;
}

.menuHeader1 {
    padding: 3px 3px 3px 3px;
    color: white;
    background-color: grey;
}

.menuHeader2 {
    margin-top: 5px;
    padding: 3px 3px 3px 3px;   
    background-color: silver;
}

.secondaryMenu {
    margin-left: 15px;  
    padding: 3px 3px 3px 3px;
}

.cellnumber {
    text-align: right;
}

.rowheader {
    font-weight: bold;
}

CodePudding user response:

The problem stems from your over-zealous CSS reset:

* {
    margin: 0;
    padding: 0;
    font-family: verdana,arial; 
}
<ul>
  <li>Item 1</li>
  <li>Item 2</li>
</ul>

List elements require padding on the left for the bullet to be shown:

* {
    margin: 0;
    padding: 0;
    font-family: verdana,arial; 
}
ul {
  padding-left: 1em;
}
<ul>
  <li>Item 1</li>
  <li>Item 2</li>
</ul>

CodePudding user response:

If the problem is not fixed with padding on the left to let the bullet points out I would recommend giving the and try to access the individual unordered lists instead of changing both of them by calling the ul in the css.

Simply call the .testClass instead :)

  •  Tags:  
  • Related