Header <h2> floating to be below the next UL list - html

I have a multiple unordered lists, with a h2 titling each list by subject.
Here is the html
<h2>Early Childhood Education</h2>
<ul class="course-list">
<li>Child Growth and Development</li>
<li>Curriculum and Methods in Teaching Early Childhood Education</li>
<li>Introduction to Early Childhood Education</li>
<li>Introduction to Education</li>
<li>Practicum I: Early Childhood</li>
<li>Practicum II: Early Childhood</li>
<li>Practicum in Education</li>
</ul>
<h2>Emergency Medical Technician</h2>
<ul class="course-list">
<li>Emergency Medical Technician (EMT) – Basic</li>
<li>Emergency Medical Technician (EMT) – Paramedic I</li>
<li>Emergency Medical Technician (EMT) – Paramedic II (Field Internship – Part I)</li>
<li>Emergency Medical Technician (EMT) – Paramedic III</li>
<li>Emergency Medical Technician (EMT) – Paramedic IV (Field Internship – Part II)</li>
<li>EMT-Basic Fieldwork</li>
<li>Report Writing for Healthcare Professionals</li>
</ul>
<h2>English</h2>
<ul class="course-list">
<li>African American Literature</li>
<li>Basic Acting Technique</li>
<li>Contemporary American Poetry</li>
<li>English I: College Writing</li>
<li>English II: Introduction to Literature</li>
<li>Essentials of English *</li>
<li>Interpersonal Communication</li>
<li>Interviewing Practices and Principles</li>
<li>Introduction to Drama Study</li>
<li>Introduction to Poetry</li>
<li>Introduction to Technical Writing</li>
<li>Journalism</li>
<li>Journalism II</li>
<li>Literature for Children</li>
<li>Literature of the Western World</li>
<li>Major American Writers</li>
<li>Major English Writers</li>
<li>Modern American Novel</li>
<li>Nonfiction Literature</li>
<li>Public Speaking</li>
<li>Science Fiction</li>
<li>Service Learning – Volunteer Project</li>
<li>Shakespeare</li>
<li>Storytelling</li>
<li>The Short Story</li>
<li>Voice and Diction</li>
<li>Western Mythology</li>
<li>Women in Literature</li>
<li>Writing Workshop I</li>
</ul>
Here is the CSS
.col-middle .course-list li {
width:50%;
float:left;
}
Here is a screen shot of what it looks like: http://i40.tinypic.com/2141nd3.png
The problem you see in the screen shot is the text within the h2 tags is floating up a line if there is some space after the list above it.
I fixed that by setting overflow:auto; within the ul style, but that made the left half of the list discs dissapear (as you see here: http://i39.tinypic.com/2i8y62r.png)
Also, I'd like to create some spacing between the bottom of the ul list, and the h2 header.

You might wrap each h2/ul pair in a div. This is even good for semantics, since the two are related and therefore could be said to be part of a logical division. Then you can float the whole div and keep the elements grouped.

Please try this tutorial for multi column lists
By the way, floats are evil. ;)

Are the h2 tags supposed to be above each unordered list?
Perhaps what you should do is add a clear:both to the h2 definition...
h2 { clear: both; }

Related

How to narrow text in CSS?

I'm a beginner in HTML&CSS and now I'm coding my first project. But I'm kind of struggling with narrowing unordered lists. I attached photos that show how it must look like and how it actually looks like. If you can help me, I would be really happy.
How it must look like:
#tribute-info {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
#tribute-description {
font-size: 18px;
}
li {
font-size: 16px;
}
<div id="tribute-info">
<h3 id="tribute-description">
Here's a time line of Dr. Borlaug's life:
</h3>
<ul>
<li><strong>1914</strong> - Born in Cresco, Iowa</li>
<li>
<strong>1933</strong> - Leaves his family's farm to attend the University of Minnesota, thanks to a Depression era program known as the "National Youth Administration"
</li>
<li>
<strong>1935</strong> - Has to stop school and save up more money. Works in the Civilian Conservation Corps, helping starving Americans. "I saw how food changed them", he said. "All of this left scars on me."
</li>
<li>
<strong>1937</strong> - Finishes university and takes a job in the US Forestry Service
</li>
<li>
<strong>1938</strong> - Marries wife of 69 years Margret Gibson. Gets laid off due to budget cuts. Inspired by Elvin Charles Stakman, he returns to school study under Stakman, who teaches him about breeding pest-resistent plants.
</li>
<li>
<strong>1941</strong> - Tries to enroll in the military after the Pearl Harbor attack, but is rejected. Instead, the military asked his lab to work on waterproof glue, DDT to control malaria, disinfectants, and other applied science.
</li>
<li>
<strong>1942</strong> - Receives a Ph.D. in Genetics and Plant Pathology
</li>
<li>
<strong>1944</strong> - Rejects a 100% salary increase from Dupont, leaves behind his pregnant wife, and flies to Mexico to head a new plant pathology program. Over the next 16 years, his team breeds 6,000 different strains of disease resistent
wheat - including different varieties for each major climate on Earth.
</li>
<li>
<strong>1945</strong> - Discovers a way to grown wheat twice each season, doubling wheat yields
</li>
<li>
<strong>1953</strong> - crosses a short, sturdy dwarf breed of wheat with a high-yeidling American breed, creating a strain that responds well to fertilizer. It goes on to provide 95% of Mexico's wheat.
</li>
<li>
<strong>1962</strong> - Visits Delhi and brings his high-yielding strains of wheat to the Indian subcontinent in time to help mitigate mass starvation due to a rapidly expanding population
</li>
<li><strong>1970</strong> - receives the Nobel Peace Prize</li>
<li>
<strong>1983</strong> - helps seven African countries dramatically increase their maize and sorghum yields
</li>
<li>
<strong>1984</strong> - becomes a distinguished professor at Texas A&M University
</li>
<li>
<strong>2005</strong> - states "we will have to double the world food supply by 2050." Argues that genetically modified crops are the only way we can meet the demand, as we run out of arable land. Says that GM crops are not inherently dangerous
because "we've been genetically modifying plants and animals for a long time. Long before we called it science, people were selecting the best breeds."
</li>
<li><strong>2009</strong> - dies at the age of 95.</li>
</ul>
</div>
You can wrap your <ul> in a <div> and center it like this:
.list {
max-width: 700px;
margin: 0 auto;
}
.list li {
margin-bottom: 1em;
}
<div class="list">
<ul>
<li>Your list here</li>
<li>Your list here</li>
<li>Your list here</li>
<li>Your list here</li>
<li>Your list here</li>
</ul>
</div>
Just add a CSS rule that limits the width of that ul. You can either use a class or ID on the ul for that or use a child selector like this:
#tribute-info > ul {
max-width: 400px;
}
(This applies to any ul which is a direct child ot the #tribute-info element - in your case only one, i.e. that list)
#tribute-info {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
#tribute-description {
font-size: 18px;
}
li {
font-size: 16px;
}
#tribute-info > ul {
max-width: 400px;
}
<div id="tribute-info">
<h3 id="tribute-description">
Here's a time line of Dr. Borlaug's life:
</h3>
<ul>
<li><strong>1914</strong> - Born in Cresco, Iowa</li>
<li>
<strong>1933</strong> - Leaves his family's farm to attend the University of Minnesota, thanks to a Depression era program known as the "National Youth Administration"
</li>
<li>
<strong>1935</strong> - Has to stop school and save up more money. Works in the Civilian Conservation Corps, helping starving Americans. "I saw how food changed them", he said. "All of this left scars on me."
</li>
<li>
<strong>1937</strong> - Finishes university and takes a job in the US Forestry Service
</li>
<li>
<strong>1938</strong> - Marries wife of 69 years Margret Gibson. Gets laid off due to budget cuts. Inspired by Elvin Charles Stakman, he returns to school study under Stakman, who teaches him about breeding pest-resistent plants.
</li>
<li>
<strong>1941</strong> - Tries to enroll in the military after the Pearl Harbor attack, but is rejected. Instead, the military asked his lab to work on waterproof glue, DDT to control malaria, disinfectants, and other applied science.
</li>
<li>
<strong>1942</strong> - Receives a Ph.D. in Genetics and Plant Pathology
</li>
<li>
<strong>1944</strong> - Rejects a 100% salary increase from Dupont, leaves behind his pregnant wife, and flies to Mexico to head a new plant pathology program. Over the next 16 years, his team breeds 6,000 different strains of disease resistent
wheat - including different varieties for each major climate on Earth.
</li>
<li>
<strong>1945</strong> - Discovers a way to grown wheat twice each season, doubling wheat yields
</li>
<li>
<strong>1953</strong> - crosses a short, sturdy dwarf breed of wheat with a high-yeidling American breed, creating a strain that responds well to fertilizer. It goes on to provide 95% of Mexico's wheat.
</li>
<li>
<strong>1962</strong> - Visits Delhi and brings his high-yielding strains of wheat to the Indian subcontinent in time to help mitigate mass starvation due to a rapidly expanding population
</li>
<li><strong>1970</strong> - receives the Nobel Peace Prize</li>
<li>
<strong>1983</strong> - helps seven African countries dramatically increase their maize and sorghum yields
</li>
<li>
<strong>1984</strong> - becomes a distinguished professor at Texas A&M University
</li>
<li>
<strong>2005</strong> - states "we will have to double the world food supply by 2050." Argues that genetically modified crops are the only way we can meet the demand, as we run out of arable land. Says that GM crops are not inherently dangerous
because "we've been genetically modifying plants and animals for a long time. Long before we called it science, people were selecting the best breeds."
</li>
<li><strong>2009</strong> - dies at the age of 95.</li>
</ul>
</div>
Michael, answer by Lee Taylor is a nice one, in case you do not want a div element wrapping the list you can directly apply the "list" class to the element:
<ul class="list">
<li>Your list here</li>
<li>Your list here</li>
<li>Your list here</li>
<li>Your list here</li>
<li>Your list here</li>
</ul>
As well you must be sure that the unordered list is wrapped inside a container wider in size than element.

I need to mix a numbered list with a bulleted list, validator says this is wrong

As the subject says, I wrote this code to mix numbered list with bulleted list, it worked perfectly exactly the way I wanted it too but the validator says this is a no no so what's the proper way to do this? Below is my code:
<ol>
<li>Public, private & religious schools programs and assemblies</li>
<ul>
<li>School assembly in elementary, middle, junior high, and high schools</li>
<li>presentation to individual classes as part of the social studies or history curriculum at all grade levels</li>
<li>Present video clips on various related topics followed by class/group discussions and activities.</li>
<li>Work with youth groups/boy scouts/girl guides/YWCA</li>
<li>After school programs</li>
<li>Work with school-age after school programs</li>
<li>Work with early childhood programs</li>
<li>Community programs & activities
</ul>
<li>Topics to include but not limited to -</li>
<ul>
<li>Prejudice</li>
<li>Stereotyping</li>
<li>Implicit bias</li>
<li>Discrimination</li>
etc...
Place the ul within the li no the ol:
<ol>
<li>Public, private & religious schools programs and assemblies
<ul>
<li>School assembly in elementary, middle, junior high, and high schools</li>
<li>presentation to individual classes as part of the social studies or history curriculum at all grade levels</li>
<li>Present video clips on various related topics followed by class/group discussions and activities.</li>
<li>Work with youth groups/boy scouts/girl guides/YWCA</li>
<li>After school programs</li>
<li>Work with school-age after school programs</li>
<li>Work with early childhood programs</li>
<li>Community programs & activities
</ul>
</li>
<li>Topics to include but not limited to -
<ul>
<li>Prejudice</li>
<li>Stereotyping</li>
<li>Implicit bias</li>
<li>Discrimination</li>
</ul>
</li>
</ol>

Why does bottom h3 title become indented?

I add two titles: "Education" & "My Hobbies"
Why are they not aligned?
I have went thru the code and managed to fix some nesting list issues but that did not fix above problem.
<body>
<h1>Vlad Myshchuk</h1>
<p><em><strong>Software Engineer</strong><br>Full Stack Developer</em></p>
<p>I am self-taught student of programming. My focus as a Software Engineer is primarily on Full Stack Software & Web Development. I hold a degree in Accounting A.A.S. as well as Computer Information Systems A.A.S.</p>
<hr>
<h3>Education</h3>
<ul>
<li>Hudson Valley Community College</li>
<li>State University of New York College at Oneonta</li>
<li>Recent courses at Udemy:
<ul>
<li>The Complete 2019 Web Development Bootcamp with Professor Angela Yu</li>
</ul>
</li>
<li>Books
<ul>
<li>Pragmatic Thinking and Learning by Andy Hunt</li>
<li>Code: The Hidden Language of Computer Hardware and Software by Charles Petzold</li>
<li>Code Complete: A Practical Handbook of Software Construction by Steve McConell</li>
<li>Clean Code: A Handbook of Agile Software Cragsmanship by Robert C. Martin</li>
</ul>
</li>
<h3>My Hobbies</h3>
<ol>
<li>Completing algorithms on codechef.com and codingame.com</li>
<li>Practice a variety of meditation and yoga.</li>
<li>Weight training and high intensity interval training (HIIT).</li>
<li>Reading books on psychology as well as philosophy.</li>
<li>Listening to educational podcasts and recorded lectures.</li>
</ol>
</body>
I expect both headers to be positioned to the very left.
You did a silly mistake dear. You have to just complete
</ul>
tag before
<h3>My Hobbies</h3>
after correct it your problem will be solve.
Just a typo i expect, there was an unescaped h3 tag. There's a handy tool you can use to check: https://www.aliciaramirez.com/closing-tags-checker/
<body>
<h1>Vlad Myshchuk</h1>
<p><em><strong>Software Engineer</strong><br>Full Stack Developer</em></p>
<p>I am self-taught student of programming. My focus as a Software Engineer is primarily on Full Stack Software & Web Development. I hold a degree in Accounting A.A.S. as well as Computer Information Systems A.A.S.</p>
<hr>
<h3>Education</h3>
<ul>
<li>Hudson Valley Community College</li>
<li>State University of New York College at Oneonta</li>
<li>Recent courses at Udemy:
<ul>
<li>The Complete 2019 Web Development Bootcamp with Professor Angela Yu</li>
</ul>
</li>
<li>Books
<ul>
<li>Pragmatic Thinking and Learning by Andy Hunt</li>
<li>Code: The Hidden Language of Computer Hardware and Software by Charles Petzold</li>
<li>Code Complete: A Practical Handbook of Software Construction by Steve McConell</li>
<li>Clean Code: A Handbook of Agile Software Cragsmanship by Robert C. Martin</li>
</ul>
</li>
</ul>
<h3>My Hobbies</h3>
<ol>
<li>Completing algorithms on codechef.com and codingame.com</li>
<li>Practice a variety of meditation and yoga.</li>
<li>Weight training and high intensity interval training (HIIT).</li>
<li>Reading books on psychology as well as philosophy.</li>
<li>Listening to educational podcasts and recorded lectures.</li>
</ol>
</body>

Scrollbar customization

I've the below HTML Code.
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="chat-box-new-div">
<div class="chat-box-new-head">Frequently Asked Questions ..
</div>
<div class="panel-body chat-box-new">
<ul class="questionsUl">
<li>Who is a public official? </li>
<li>My client asked if her son can intern with the company as a favor to her, that isn't a problem is it? </li>
<li>My friend works for the client, does that mean I can't give her a gift? </li>
<li>Is there certain criteria for gifts and entertainment </li>
<li>How do I know if Gift or Entertainment is permissible? </li>
<li>can I give gift cards to my team? </li>
<li>Do I need approval to give a gift? </li>
<li>Are Facilitating Payments” to Public Officials allowed? </li>
<li>is there approval needed for gifts to public officials? </li>
<li>Who is a public official? </li>
<li>My client asked if her son can intern with the company as a favor to her, that isn't a problem is it? </li>
<li>My friend works for the client, does that mean I can't give her a gift? </li>
<li>Is there certain criteria for gifts and entertainment </li>
<li>How do I know if Gift or Entertainment is permissible? </li>
<li>can I give gift cards to my team? </li>
<li>Do I need approval to give a gift? </li>
<li>Are Facilitating Payments” to Public Officials allowed? </li>
<li>is there approval needed for gifts to public officials? </li>
<li>Who is a public official? </li>
<li>My client asked if her son can intern with the company as a favor to her, that isn't a problem is it? </li>
<li>My friend works for the client, does that mean I can't give her a gift? </li>
<li>Is there certain criteria for gifts and entertainment </li>
<li>How do I know if Gift or Entertainment is permissible? </li>
<li>can I give gift cards to my team? </li>
<li>Do I need approval to give a gift? </li>
<li>Are Facilitating Payments” to Public Officials allowed? </li>
<li>is there approval needed for gifts to public officials? </li>
<li>Who is a public official? </li>
<li>My client asked if her son can intern with the company as a favor to her, that isn't a problem is it? </li>
<li>My friend works for the client, does that mean I can't give her a gift? </li>
<li>Is there certain criteria for gifts and entertainment </li>
<li>How do I know if Gift or Entertainment is permissible? </li>
<li>can I give gift cards to my team? </li>
<li>Do I need approval to give a gift? </li>
<li>Are Facilitating Payments” to Public Officials allowed? </li>
<li>is there approval needed for gifts to public officials? </li>
<li>Who is a public official? </li>
<li>My client asked if her son can intern with the company as a favor to her, that isn't a problem is it? </li>
<li>My friend works for the client, does that mean I can't give her a gift? </li>
<li>Is there certain criteria for gifts and entertainment </li>
<li>How do I know if Gift or Entertainment is permissible? </li>
<li>can I give gift cards to my team? </li>
<li>Do I need approval to give a gift? </li>
<li>Are Facilitating Payments” to Public Officials allowed? </li>
<li>is there approval needed for gifts to public officials? </li>
<li>Who is a public official? </li>
<li>My client asked if her son can intern with the company as a favor to her, that isn't a problem is it? </li>
<li>My friend works for the client, does that mean I can't give her a gift? </li>
<li>Is there certain criteria for gifts and entertainment </li>
<li>How do I know if Gift or Entertainment is permissible? </li>
<li>can I give gift cards to my team? </li>
<li>Do I need approval to give a gift? </li>
<li>Are Facilitating Payments” to Public Officials allowed? </li>
<li>is there approval needed for gifts to public officials? </li>
</ul>
</div>
</div>
</div>
Here Basically, I've a parent and 2 child divs. and inside the second child div, there is some content and this is not limited, more the content, we should get a scroll bar to scroll (This is working fine currently).
I'm using overflow to get the scrollbar, but the issue is like this,
If I take the scroll bar on the parent div, the scroll is working till the end.
When I take the same in the child div, it is not scrolling the entire content.
But I want the scroll in the second div(the child div) and display the entire data.
here is a working fiddle.
https://jsfiddle.net/a1zhffka/
please let me know how can I fix this.
Thanks
Something like this? https://jsfiddle.net/a1zhffka/2/
You need to add the overflow to chat-box-new. From your question it sounds like you already tried this, but your main issue was the height. The height of the div should be the height of the container, minus the height of the header. By having too tall of a height, the content will be cut-off.
For this specific example, 461px seems like the sweet spot.
.chat-box-new {
overflow-y: scroll;
height: 461px;
}
And remove the scroll from the parent:
.chat-box-new-div {
height: 502px;
border: 2px solid #157DEC;
border-bottom: 2px solid #157DEC;
overflow: hidden;
}
For future consideration, you can avoid hard-coding all the heights if you give your header a fixed-height of say 50px, and then use height: calc(100% - 50px);

Codecademy: Nested Lists

I'm doing a lesson on Codecademy about nested lists in html.
My code is as follows:
<ul>
<li>Work? I am currently unemployed.
Here's a list of things that I have
done though:
<ol>
<li>Farm Hand</li>
<li>Excersize Rider</li>
<li>Curator's Assistant</li>
<li>Teaching Assistant</li>
<li>Telephone Operator</li>
</ol>
</li>
<li>Education? I have dropped out of the
following institutions:
<ol>
<li>
Highschool (I did complete all
courses and receive credit)
</li>
<li>
College (I withdrew for
medical reasons)
</li>
</ol>
</li>
<li>Interests? Here are a select few:
<ol>
<li>Running</li>
<li>Martial arts</li>
<li>Equestrian activities</li>
<li>Video games</li>
</ol>
</li>
<li>Favorite Quotes
<ol>
<li>"This was a triumph"</li>
<li>
"It's not safe to go alone,
here, take this!"
</li>
<li>
"Our princess is in
another castle!"
</li>
</ol>
</li>
</ul>
However, the lesson throws the following error when I try to submit this code:
Oops, try again. Make sure you have at least one unordered list inside your unordered list of profile sections!
What am I doing wrong?
According to the error,
Oops, try again. Make sure you have at least one unordered list inside your unordered list of profile sections!
you need one unordered list inside your unordered list of profile sections. Currently, all of your internal lists are ordered lists (<ol>). Try turning one of them into a <ul>.
For example, this should match your error desciption:
<ul>
<li>Work? I am currently unemployed.
Here's a list of things that I have
done though:
<ul> <!--(Unordered List!)-->
<li>Farm Hand</li>
<li>Excersize Rider</li>
<li>Curator's Assistant</li>
<li>Teaching Assistant</li>
<li>Telephone Operator</li>
</ul>
</li>
<li>Education? I have dropped out of the
following institutions:
<ol>
<li>
Highschool (I did complete all
courses and receive credit)
</li>
<li>
College (I withdrew for
medical reasons)
</li>
</ol>
</li>
<li>Interests? Here are a select few:
<ol>
<li>Running</li>
<li>Martial arts</li>
<li>Equestrian activities</li>
<li>Video games</li>
</ol>
</li>
<li>Favorite Quotes
<ol>
<li>"This was a triumph"</li>
<li>
"It's not safe to go alone,
here, take this!"
</li>
<li>
"Our princess is in
another castle!"
</li>
</ol>
</li>
</ul>