Louie Henderson Louie Henderson - 17 days ago 5
CSS Question

Unexplained padding in unordered list within table

I'm currently putting together a little start page but I'm having trouble with some unexplained padding issues in a list. Here is the full code so far:

<style type="text/css">

html, * {
font-family: Hermit, monospace;
color: #eceff1;font-size: 12px;
height: 100%;
}

body {
font-size: 12px;

background: #222c32;
color: #222c32;
margin: 0;
padding: 0;
}

ul {
list-style-type: none;
margin: 0;
padding: 0;
}

li {
margin-left: 15px;
}

h1 {
font-size: 16px;
color: #222c32;
text-align: center;
margin: 0;
padding: 0;
}

p {
color: #222c32;
margin: 0;
padding: 0;
}

a {
color: #222c32;
text-decoration: none;
}

.theme {
outline: 3px solid black;
background: white;
color: black;
}

.container {
display: table;
position: absolute;
height: 100%;
width: 100%;
}

.cent {
display: table-cell;
vertical-align: middle;
}

.content {
margin-left: auto;
margin-right: auto;
width: 800px;
height: 500px;
}

.links {
margin: 10px 5px 5px 10px;
width: 555px;
height: 445px;
float: left;
position: relative;
}

.picture1 {
color: black;
margin: 10px 10px 5px 5px;
width: 215px;
height: 215px;
float: right;
position: relative;
background: url("dmc.jpg")
}

.picture2 {
margin: 10px 10px 5px 5px;
width: 215px;
height: 215px;
float: right;
position: relative;
background: url("kaneda.jpg")
}

.gsearch {
margin: 5px 5px 10px 10px;
width: 555px;
height: 25px;
float: left;
position: relative;
}

.ysearch {
margin: 5px 10px 10px 5px;
width: 215px;
height: 25px;
float: right;
position: relative;
}

.header {
margin-top: 150px;
height: auto;
text-align: center;
}

.linktext {
margin-left: 10px;
text-align: center;
}

</style>

</head>
<body>
<div class="container">
<div class="cent">
<div class="content">
<div class="links theme">
<div class="header">
<h1>kakarotten</h1>
<table>
<tr>
<th>
<ul>
<li><a href="http://boards.4chan.org/a/">/a/</a></li>
<li><a href="http://boards.4chan.org/asp/">/asp/</a></li>
<li><a href="http://boards.4chan.org/mu/">/mu/</a></li>
<li><a href="http://boards.4chan.org/tg/">/tg/</a></li>
<li><a href="http://boards.4chan.org/w/">/w/</a></li>
</ul>
</th>
<th>
<ul>
<li><a href="https://reddit.com/r/squaredcircle/">sqrdcrcl</a></li>
<li><a href="https://reddit.com/r/unixporn/">unxprn</a></li>
<li><a href="https://reddit.com/r/vinyl">vinyl</a></li>
</ul>
</th>
</tr>
</table>
</div>
</div>
<div class="picture1 theme"></div>
<div class="picture2 theme"></div>
<div class="gsearch theme"></div>
<div class="ysearch theme"></div>
</div>
</div>
</div>
</body>
</html>


The second list along seems to be spacing itself out, I'm just wondering why.

Answer

I agree with @junkfoodjunkie. But it's because of this CSS rule

html, * {
    font-family: Hermit, monospace;
    color: #eceff1;font-size: 12px;
    height: 100%;
}

This is setting everything to be 100% of it's container's height.

Also, you could use display:inline-block; on each <ul> to place them next to each other instead of using a table.

Comments