fixing how list are placed with html/ccs - html

In the picture its shown that the 2 sets of list aren't at the same height or width. I am new to html/ccs and I cant figure how to fix it.
I've already tried to chance the margin to 0 instead of auto because i though it would solve the problem.
The line of code I've been told my mistake is placed in is this:
ul.lister {
display: inline-block;
text-align: left;
margin-top: auto;
margin-buttom: auto;
}
<ul class="lister">
<p><big>Jeg ønsker mig... (snacks edition)</big></p>
<li> FaxeKondi (gerne i ramme).</li>
<li> Saltede peanuts </li>
<li> Corny Müslibar m. banan og chokolade</li>
<li> MælkeChokolade</li>
<li> HvidChokolade</li>
</ul>
<ul class="lister">
<p><big>Jeg ønsker mig... (gavekort edition)</big></p>
<li> Sport24</li>
<li> Normal</li>
<li> Løvbjerg</p>
<li> Føtex</li>
<li> Lidl</li>
<li> Aldi</li>
<li> MacDonals</li>
<li> Netto</li>
</ul>
thanks in advance and sorry if there is some words that have been misspelled

First, you've got some errors in your markup: The only permitted content inside ul elements are the list item element (<li>). Inside list items you could put a <p>, but I would recommend to put the list heading outside the list for readability.
Then in your CSS, you've got margin-buttom, which should be margin-bottom.
Finally, there are several ways to put elements side by side in CSS and I will not tell you how to do that, but take a look at this article to get some ideas how you could solve it.

The two items aren't equal width or height because they'll only take up as much space as needed and that's dependent on the content width and height.
If you wrap each list item in a container and use display:flex then that'll make them appear side by side. You can then use flex-basis in the child elements to make them equal width. Finally putting paragraphs in unordered lists isn't great so I've separated them out and wrapped that block in divs of their own that can be sized appropriately.
CSS tricks is a good starting point for flexbox
There's also some syntax errors that I've corrected.
Also note that the big tag isn't supported in html5
See below
.container {
display: flex;
}
.lister {
flex-basis: 50%;
text-align: left;
margin-top: auto;
margin-bottom: auto;
}
<div class="container">
<div class="lister">
<p><big>Jeg ønsker mig... (snacks edition)</big></p>
<ul>
<li> FaxeKondi (gerne i ramme).</li>
<li> Saltede peanuts </li>
<li> Corny Müslibar m. banan og chokolade</li>
<li> MælkeChokolade</li>
<li> HvidChokolade</li>
</ul>
</div>
<div class="lister">
<p><big>Jeg ønsker mig... (gavekort edition)</big></p>
<ul>
<li> Sport24</li>
<li> Normal</li>
<li> Løvbjerg</li>
<li> Føtex</li>
<li> Lidl</li>
<li> Aldi</li>
<li> MacDonals</li>
<li> Netto</li>
</ul>
</div>
</div>

Related

How can I move a ul list bullet marker very slightly to one direction?

I'm making a typora theme and styling it with CSS. I don't really have much access to the HTML generated since it's generated by the program, but it does provide a lot of flexibility.
I'm trying to just move UL ::markers a couple pixels to the right.
Anyone know a solution?
Thanks much.
As #enhzflep suggested in a comment, you could increase the space before the bullet by applying padding on the ul in CSS. Here's how it's done (I have made two lists—ordered and unordered):
ul {
padding-inline-start: 39px
}
<ol>
<li> First </li>
<li> Second </li>
<li> Third </li>
</ol>
<hr>
<ul>
<li> First </li>
<li> Second </li>
<li> Third </li>
</ul>

<ol> list item number not aligned with item content?

Weird problem that <ol> list item number isn't aligned with its content. See live page or screenshots: 1, 2
See the line numbers of the ordered list isn't aligned with its content. They are all down below when the screen is wide and up in the air when the screen is narrow.
Thought it's something wrong with the CSS since both Chrome and Firefox render the list this way, but didn't find any weird styles at all in the stylesheets. Is this normal behavior of HTML5 <ol>? How can I make it the item numbers are aligned to the top line of its corresponding content, both wide and narrow screen?
This is because you have applied display:inline-block to the <a> tags. Just apply display:block to the <a> tags
Stack Snippet
a {
display: block;
margin-bottom: 10px;
}
<ol>
<li> <a>http://n3.datasn.io/data/api/v1/n3_lyz/cars_and_powersports_vehicle_and_motorcycle_and_boat_14/atv/list/?app=html-bunker</a>
</li>
<li> <a>http://n3.datasn.io/data/api/v1/n3_lyz/cars_and_powersports_vehicle_and_motorcycle_and_boat_14/atv/list/?app=html-bunker</a>
</li>
<li> <a>http://n3.datasn.io/data/api/v1/n3_lyz/cars_and_powersports_vehicle_and_motorcycle_and_boat_14/atv/list/?app=html-bunker</a>
</li>
<li> <a>http://n3.datasn.io/data/api/v1/n3_lyz/cars_and_powersports_vehicle_and_motorcycle_and_boat_14/atv/list/?app=html-bunker</a>
</li>
</ol>
It has to do with the CSS rule for .links-4 a. It sets display: inline-block;. If you change it to display: inline, it'll be fine.

Center my Chart Using a Div Tag

I am using align="center", but it does not work and it is the same left.
My code is below:
<div align="center">
<div class="tree">
<ul>
<li>
my text
<ul>
<li>
text
<ul>
<li>
<ul>
<li>
text
</li>
<li>
text
</li>
<li>
text
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
what tag should I use? I want the entire to chart go to the center.
this is output https://codepen.io/anon/pen/boQqrg
I would suggest using margin: auto; if that did not work.
Also note that one problem you may be having is that you were using align="center". Using quotation marks will not work.
I should remove float on .tree li and add margin: auto to .tree ul.
If you want to center it horizontally and vertically, add this to your ul tag:
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
But I'd suggest that you review your entire code. You're using floats without clearfixing (read more here) and it causes the height to collapse.

Adjustable divs and positioning

Hi I've written some code where I have create two divs wrapped inside another div. I have then create a league table and floated it to the right hand side. I have made the 2 divs on the left hand side small enough for the league to go alongside them however it doesn't seem to move upwards it stay in it position below the 2 divs. Also when I would like my 2 divs on the left hand side to adjust to whatever is inside my them. At the moment if I have one line inside the div its height is still fitted for 10 lines.
Should I use flex box for this? Any help would be much appreciated
`
<li id="et"> England
<ul>
<li>Premiership
</li>
<li>Championship
</li>
<li>League 1
</li>
<li>League 2
</li>
</ul>
</li>
<li id="et"> France
<ul>
<li>Ligue 1
</li>
</ul>
</li>
<li id="et"> Germany
<ul>
<li>Bundesliga
</li>
</ul>
</li>
<li id="et"> Italy
<ul>
<li>Serie A
</li>
</ul>
</li>
<li id="et"> Spain
<ul>
<li>La Liga
</li>
</ul>
</li>
</ul>
</div>
<!-- Nav wrapper end -->
`https://jsfiddle.net/e2cmhrec/
jsFiddle demo
You .wrap has
width:70%;
margin-left:3%;
with some elementary calculation you have remaining: 27%.
But than suddenly you decided to make your right floated #sidebar
width: 30%
Even if you used erratically width:30% than suddenly your table inside the sidebar has:
width:120%;
Don't forget to float:left your .wrap if you want to accomodate your #sidebar to the right float.
Your .wrap has display: table; and you used for the first child display:table-cell. What about the second child?
Also why use float:left on a table-cell element?
To improve your table.grid look'n'feel you might want to use:
border-collapse:collapse;
also where you have yoru injuries and suspension cells, use for the display:table element also:
border-spacing: 16px; /* learn CSS rules */
border-collapse: separate; /* learn CSS rules */
I've also seen a funny thing, you named a class .ArsStand for Arsenal that gives a red border... top and apparently not the bottom one, so you decided to add the same class to the team underneath... No. 1. try not to name classes related to a variable page content. 2. create your special classes after the common element rules (in order to overwrite them.)
Don't add height to tables... one day you might have more data and question why it's all so squished. Rather add vertical padding to your td elements.
You cannot have duplicate ID elements in a single page! id="headinj"

HTML DIV contradicting a DIV that it is in

For the navigation on a website I am making I am using a side bar that is set up using an unordered list. There are also multiple lists inside of lists. I used multiple div's too. I have now run into the issue that form inside of a div I need to set up some code that will contradict the div that it is in. In my case I have css of line-height: 35px; I need to edit this to become 15px.
Here is the code i need to edit it is the center( sub List )
<li>
<h2> Tech Ed. Classes</h2>
</div>
<div id="sidebarLinks"><!-- USE THIS DIV SECTION FOR A LIST WITH BULLET POINTS -->
<ul>
<li><strong><em>Main Page</em></strong></li>
<li>Construction</li>
<li>Drafting</li>
<li>Electronics</li>
<ul id="subList">
<li >INTRODUCTION TO ELECTRONICS</li>
<li>EXPLORING CAREERS IN ELECTRONICS</li>
</ul>
<li>Graphic arts </li>
<li>Manufacturing</li>
<li>Project Lead the Way</li>
<li>Transportation, Distribution, & Logitstics</li>
<li>Wood Working</li>
</ul>
</div>
</li>
You can do this simply by adding a css class to the elements you want to change to be different from the div they are in. For example:
li {
line-height: 35px;
}
.smaller {
line-height: 15px;
}
This CSS will make the line-height on all <li> elements equal to 35px, except for <li> elements with a class of smaller. Those will have a line-height of 15px. For example:
<ul>
<li>This will have a line height of 35 pixels.</li>
<li class="smaller">This will have a height of 15 pixels.</li>
</ul>
<ul class="smaller">
<li>This will have a line height of 15 pixels, the ul has a class of smaller.</li>
<li class="smaller">This will have a height of 15 pixels as well.</li>
</ul>
JSFiddle
I would suggest adding a more specific selector for the inner list. This method would not require any changes to your existing markup:
#sidebarLinks {
line-height: 25px;
}
#sidebarLinks #subList {
line-height: 15px;
}
Here is a fiddle demonstrating the above selectors: JSFiddle