ul li timetable elements overlapping - html

Making a responsive timetable which switches to a list format for mobile, with Weekdays acting as headers and relevant sessions being listed below.
I've encountered a problem where li elements overlap. Despite experimenting with position and display values, I can't figure out how to counteract this overlap.
Any help would be appreciated.
.smallTableContainer {
position: relative;
display: none;
height: auto;
overflow: hidden;
}
.weekdayHeader {
background: #bc4b51;
color: #efefef;
font-size: 18pt;
padding: 10px 0px;
}
.sessions {
padding: 0;
}
.className {
float: left;
display: inline-block;
color: #1e1e1e;
font-size: 13pt;
padding-left: 10px;
}
.classTime {
float: right;
display: inline-block;
color: #1e1e1e;
font-size: 12pt;
padding-right: 10px;
}
<div class="smallTableContainer">
<h3 class="weekdayHeader">Monday</h3>
<ul class="sessions">
<li>
<div class="className">
Warrior Cubs Kickboxing
<br>AGES 5-7
<br>[ SPACES AVAILABLE ] </div>
<div class="classTime">
<br> 16.15pm - 17.00pm
</div>
</li>
<li>
<div class="className">
Warrior Cubs Kickboxing
<br>AGES 8-12
<br>[ SPACES AVAILABLE ]
</div>
<div class="classTime">
<br> 17.00pm - 17.45pm
</div>
</li>
</ul>
</div>

If I understand your desired result correctly, you want the events and times to disaply on individual lines. In order to do this, all you're looking for is cleart: both on your .sessions li. In addition to this, you'll probably want to add a bit of spacing between each event, which can be done by adding margin-top to the (rather complex) .sessions li:not(:first-of-type) .className selector. This ensures that the margin will be applied to all of the listings apart from the first one.
This can be seen in the following:
.smallTableContainer {
position: relative;
/*display: none;*/
height: auto;
overflow: hidden;
}
.weekdayHeader {
background: #bc4b51;
color: #efefef;
font-size: 18pt;
padding: 10px 0px;
}
.sessions {
padding: 0;
}
.sessions li {
clear: both;
}
.className {
float: left;
display: inline-block;
color: #1e1e1e;
font-size: 13pt;
padding-left: 10px;
}
.classTime {
float: right;
display: inline-block;
color: #1e1e1e;
font-size: 12pt;
padding-right: 10px;
}
.sessions li:not(:first-of-type) .className {
margin-top: 20px;
}
<div class="smallTableContainer">
<h3 class="weekdayHeader">Monday</h3>
<ul class="sessions">
<li>
<div class="className">
Warrior Cubs Kickboxing
<br>AGES 5-7
<br>[ SPACES AVAILABLE ] </div>
<div class="classTime">
<br> 16.15pm - 17.00pm
</div>
</li>
<li>
<div class="className">
Warrior Cubs Kickboxing
<br>AGES 8-12
<br>[ SPACES AVAILABLE ]
</div>
<div class="classTime">
<br> 17.00pm - 17.45pm
</div>
</li>
</ul>
</div>

Related

How can I successfully create a two columns layout? One for a vertical navigation bar to the left and the content to the right

I am trying to make two columns one for a vertical navigation bar to the left and the content column should float right. I tried every method possible. The page did not look good at all. I do not know what I am missing. Any help will be greatly appreciated. Any suggestions? I have been trying for hours but have not been successful. I am still learning the process. I tried floating the Navigation bar left and the content right, but that did not work as desired.
body {
background-color: red;
color: black;
font-family: Verdana, Arial, sans-serif;
}
#wrapper {
background-color: #dce9f7;
margin-left: auto;
margin-right: auto;
width: 70%;
min-width: 700px;
box-shadow: 5px 5px 5px 5px #828282;
}
h1 {
background-color: #d9c7b4;
color: black;
text-align: center;
}
h2 {
background-color: white;
font-size: 1.2em;
padding-left: 10px;
padding-bottom: 5px;
}
#nav {
text-align: center;
}
#content {
padding: 25px;
}
.floatright {
float: right;
padding-bottom: 20px;
}
.floatleft {
float: left;
padding: 20px;
}
<div id="wrapper">
<h1>The Nothing Burger</h1>
<div id="nav">
Home
Menu
Location
</div>
<h2>Only the best food!</h2>
<div class="floatright">
<img src="plate.jpg" alt="Great Food" width="333" height="156">
</div>
<div id="content">
<ul>
<li>Fresh, Healthy Cuisine</li>
<li>Friendly Service</li>
<li>Open for Breakfast, Lunch and Dinner</li>
</ul>
</div>
<div>123 Elm Street<br/> Appleton, CA<br/> 1-888-555-5555
<br/><br/>
</div>
</div>
Add a wrapper div around the navbar element and the content element like shown below and add these styles
.wrapperDiv {
display: flex;
}
#nav {
width: 30%;
}
.content-wrapper {
width: 70%
}
#nav a {
display: block;
}
body {
background-color: red;
color: black;
font-family: Verdana, Arial, sans-serif;
}
#wrapper {
background-color: #dce9f7;
margin-left: auto;
margin-right: auto;
width: 70%;
min-width: 700px;
box-shadow: 5px 5px 5px 5px #828282;
}
h1 {
background-color: #d9c7b4;
color: black;
text-align: center;
}
h2 {
margin: 0;
background-color: white;
font-size: 1.2em;
padding-left: 10px;
padding-bottom: 5px;
}
#nav {
text-align: center;
}
#content {
padding: 25px;
}
.floatright {
float: right;
padding-bottom: 20px;
}
.floatleft {
float: left;
padding: 20px;
}
.wrapperDiv {
display: flex;
}
#nav {
width: 30%;
}
.content-wrapper {
width: 70%
}
#nav a {
display: block;
}
<body>
<div id="wrapper">
<h1>The Nothing Burger</h1>
<div class="wrapperDiv">
<div id="nav">
Home
Menu
Location
</div>
<div class="content-wrapper">
<h2>Only the best food!</h2>
<div class="floatright">
<img src="plate.jpg" alt="Great Food" width="333" height="156">
</div>
<div id="content">
<ul>
<li>Fresh, Healthy Cuisine</li>
<li>Friendly Service</li>
<li>Open for Breakfast, Lunch and Dinner</li>
</ul>
<div>123 Elm Street<br/> Appleton, CA<br/> 1-888-555-5555
<br/><br/>
</div>
</div>
</div>
</div>

What tweaks are necessary to create a responsive web page? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm fairly new to coding, so I know it's far from perfect! I'm just looking for some help getting this page to look decent on a mobile phone. Most likely, the text and picture will stack; I'm not sure what to do about the header and footer.
<body>
<h1 div id= "header"> </h1>
<div id="logos"> <img id="logo" src= "https://msu.edu/~donald88/portfolio/logo02.png" </div>
<ul id="navigation">
<li> About</li>
<li> Portfolio</li>
<li> Résumé</li>
<li> Contact</li>
</ul>
<h2> Project Spotlight </h2>
<h3> Refugee Development Center Newsletters </h3>
</br> </br>
<div id= "main">
<div class="project-image"><img src= "https://msu.edu/~donald88/portfolio/rdcnewslettertwo.png" alt="RDC newsletter" /></div>
<div id="spotlight-text"> <p class="project-text"> This is a project I did in a class during my freshman year of college. A member of the RDC staff came to my class to
give a general overview of what she wanted, and then we divided into teams to design two newsletters for this awesome organization. My team
consisted of three members, and we all worked together to write and design the newsletters. I specifically wrote the story pictured on the
left in the summer 2016 newsletter about the GLOBE camp program. I also helped collaborate on the design of both newsletters as far as color choice,
text formatting, and article length. I then edited my other team members' articles and helped assemble everything as a PDF that could be printed
or looked at online. Finally, my team gave a presentation to the rest of my class and the RDC staff member about our newsletter and the choices
we made while creating it. The client only had positive things to say about our design! </p>
<p class="project-text"> Completed: April, 2016 <br/>
Category: Web/Print </p>
</div>
<div class="back-button"> Back to portfolio </div>
<div class="portfolio-button"> See full project </div>
</div>
</p>
<div style="clear: both"></div>
<div style="clear: both"></div>
<footer class="footer">
<div class="container">
<div id="ftr-wrap">
<div class="ftr-links">
<div class= "table">
<ul>
<li> <div class="icons"><img src= "http://icons.iconarchive.com/icons/limav/flat-gradient-social/256/Twitter-icon.png"></div></li>
<li><div class="icons"><img src= "https://facebookbrand.com/wp-content/themes/fb-branding/prj-fb-branding/assets/images/fb-art.png"></div></li>
<li><div class="icons"><img src= "http://3835642c2693476aa717-d4b78efce91b9730bcca725cf9bb0b37.r51.cf1.rackcdn.com/Instagram_App_Large_May2016_200.png"></div></li>
<li><div class="icons"><img src= "https://cdn0.iconfinder.com/data/icons/social-flat-rounded-rects/512/linkedin-512.png"</div></li>
</div>
</ul>
</div>
<div class="copyright-amazon">
<p class="copyright">© Copyright Kelsie Donaldson 2016</p>
<p class="amazon"><a href="https://www.instagram.com/kelsiedonaldson/"><img
</div>
</div>
</div>
</footer>
CSS:
Body {
background-image: url("http://www.publicdomainpictures.net/pictures/140000/velka/grey-white-background.jpg");
width: 100%;
}
html {
position: relative;
min-height: 100%;
}
#header {
height: 120px;
width: 100%;
min-width: 1200px;
background-color: #b196db;
text-align: center;
font-family: 'Yesteryear', cursive;
margin: 0px;
padding-top: 20px;
padding-bottom: 20px;
line-height: 120px;
font-size: 100px;
position: relative;
}
#logo {
height: 110px;
max-width: 880px;
padding: 30px;
padding-top: 10px;
padding-bottom: 28px;
margin-top: -10em;
margin-left: auto;
margin-right: auto;
display: block;
position: relative;
}
#navigation li {
display: inline;
list-style-type: none;
padding: 50px;
float: center;
text-decoration: none; }
#navigation {
text-align: center;
min-width: 1160px;
height: 30px;
background-color: #35b7ab;
margin-top: 0px;
top: 140px;
padding-top: 15px;
font-family: Lucida bright;
font-size: 20px;
color: white
}
a {
text-decoration: none;
color: white;
}
a:hover{
color: #867289; }
h2 {
font-size: 50px;
color: #66096c;
font-family: 'Philosopher', sans-serif;
text-align: center; }
html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%; }
body {
padding:0;
margin: 0;
}
.footer {
position: absolute;
margin-bottom: -30;
margin-top: 10px;
bottom:0;
width:100%;
min-width: 1200px;
background-color: #b196db;
}
.footer p {
color: #fff;
font-size:1em;
display: inline-block;
position: relative;
bottom: 10px;
float: right;
}
.container {
max-width: 1674px; /* adjust to allow for padding as needed */
padding:0 50px; }
#ftr-wrap {
display:table;
table-layout:fixed;
width:100%;
margin:0 auto; }
#ftr-wrap > div:nth-child(1) {text-align:left;}
#ftr-wrap > div:nth-child(2) {text-align:center;}
#ftr-wrap > div:nth-child(3) {text-align:right;}
.ftr-links ul {
padding: 0;
display: inline-block;
position: relative;
margin: auto;
width: 100%; }
.table {
position: relative;
display: table;
margin: 0 auto;
display: inline-block;
list-style: none;
margin-left: 45%;
bottom: -50; }
.ftr-links ul li {
display: inline-block;
padding-right: 15px;
font-size:.75em; }
.ftr-links ul li a {
display: inline-block;
color: #fff;
margin: 0; }
.icons > img {
display: inline;
height: 40px;
width: 40px;
padding-bottom: 20px; }
#main{
height:800px;
width:100%;
}
#main {
height:500px;
width:100%;
}
.project-image{
width:40%;
color: #66096c;
height:100%;
float:left;
margin-left: 7em;
padding-right: 3em;
}
div#spotlight-text {
width:40%;
height:100%;
float:left;
font-family: Lucida Bright;
font-size: 20px;
color: #66096c;
margin-right: 2%;
}
h3 {
font-size: 30px;
color: #867289;
text-align: center;
font-family: Lucida Bright;
I understand that you want your page to look better when it gets scaled down to mobile but if you want to accomplish this, I highly recommend you check out Media Queries
They can help you accomplish what you're looking for. Also, please don't forget when using media queries to put this at the closing of your head tag in your HTML document.
<meta name="viewport" content="width=device-width, initial-scale=1">

Format two divs and two images in one line

I have two ul lists that I wrapped in divs and I want them to be side by side. There's a small icon I have left of each title that I want to float next to the title. Below is the code I have so far. It looks find when the window is large but when the window is smaller the second list is pushed under the icon before both the icon and list are pushed under the first. I don't think I formatted my css very well since ideally I would like both the second list and icon to be pushed under the first together, the moment the screen is not wide enough. How should I go about doing this?
Here's my jsfiddle https://jsfiddle.net/hw30en5z/2/
#bullet-title {
font-family: 'Oswald';
color: #004080;
font-size: 22px;
letter-spacing: 1px;
}
.table-icons {
width: 50px;
height: 50px;
margin-right: 10px;
}
#split-half {
padding-top: 2%;
margin: 0 5% 0 5%;
}
#provide {
float: left;
width: 45%;
}
#drawings {
float: left;
}
.list {
list-style: none;
padding: 0;
margin: 0;
}
.list li {
padding-left: 1em;
text-indent: -.7em;
}
.list li:before {
content: "• ";
color: #00AEEF;
}
<div id="split-half">
<img class="table-icons" src="http://animations.fg-a.com/freeicons/1-check-icon-round-purple.png" style="float:left">
<div id="provide">
<p id="bullet-title">Title 1:</p>
<ul class="list">
<li>adss</li>
</ul>
</div>
<img class="table-icons" src="http://animations.fg-a.com/freeicons/1-check-icon-round-purple.png" style="float:left">
<div id="drawings">
<p id="bullet-title">Title 2:</p>
<ul class="list">
<li>dasd</li>
</ul>
</div>
<br style="clear:both;" />
</div>
You could use responsive css to format the site when the screen has different widths. For this, you use the #media tags.
With this, you could make it so that once the screen was a certain width, both of the titles/lists go under the image.
#media (max-width: 500px) {
//css to style objects when screen is smaller than 500px
}
#media (min-width: 500px) {
//css to style objects when screen is bigger than 500px
}
Hope this helped!
You can use display:inline-block on two wrapper divs, to display 2 columns (see example below).
Some notes:
don't use inline styles like <img style="float:left"> if you can avoid it. Your code will soon be a mess, if you mix inline styles with those of your CSS file
don't use IDs multiple times, like <p id="bullet-title">. Use classes instead.
.section {
display: inline-block;
width: 200px;
}
.section > div {
display: inline-block;
}
.bullet-title {
font-family: 'Oswald';
color: #004080;
font-size: 22px;
letter-spacing: 1px;
}
.table-icons {
width: 50px;
height: 50px;
margin-right: 10px;
}
#split-half {
padding-top: 2%;
margin: 0 5% 0 5%;
}
.list {
list-style: none;
padding: 0;
margin: 0;
}
.list li {
padding-left: 1em;
text-indent: -.7em;
}
.list li:before {
content: "• ";
color: #00AEEF;
}
<div id="split-half">
<div class="section">
<img class="table-icons" src="http://animations.fg-a.com/freeicons/1-check-icon-round-purple.png">
<div id="provide">
<p class="bullet-title">Title 1:</p>
<ul class="list">
<li>adss</li>
</ul>
</div>
</div>
<div class="section">
<img class="table-icons" src="http://animations.fg-a.com/freeicons/1-check-icon-round-purple.png">
<div id="drawings">
<p class="bullet-title">Title 2:</p>
<ul class="list">
<li>dasd</li>
</ul>
</div>
</div>
</div>

How can I fix the spacing/padding issue here?

I am forced to use on page css due to a locked down template in Ektron CMS, but I am trying to resolve an issue where my h3.subhead is not aligning to the top on all three columns. In Chrome, col1 and col3 have the extra, unwanted space. In IE, all three columns have the extra space. Not sure how to fix.
* {
padding: 0;
margin: 0;
}
* a {
text-decoration: underline;
}
* a:hover {
text-decoration: none;
}
#sidebar {
width: 20%;
float: right;
padding: 15px 30px 5px 5px;
}
#left {
padding-left: 25px;
float: left;
width: 70%;
}
.clear {
clear: both;
}
#sidebar h2 {
display: block;
padding: 5px;
border-bottom: solid 1px #808184;
text-transform: uppercase;
color: #158C59;
}
#sidebar ul {
list-style: none;
/*margin-bottom:15px;*/
}
#sidebar li {
display: block;
border-bottom: solid 1px #f2eddc;
line-height: 200%;
}
h3.subhead {
font-size: 12px;
text-transform: uppercase;
color: #fff;
display: block;
padding: 5px 0 5px 5px;
background: #158c59;
}
/*.columns {padding:0 8px 0 8px;}*/
.col1 {
width: 30%;
float: left;
}
.col3 {
width: 30%;
float: right;
}
.col2 {
margin: 0 32% 0 32%;
}
.clear2 {
width: 590px;
clear: left;
float: right;
color: #fff!important;
}
.columns div {
background: #f2eddc;
height: 240px;
}
.columns div p {
padding: 5px;
}
.columns h3 {
align: top;
top: 0px;
}
#subnav {
padding: 9px 50px 0 420px;
color: #fff;
}
#subnav a {
color: #fff;
text-decoration: none;
}
img.leftalign,
img.rightalign {
display: block;
padding: 3px;
background: #efefef;
border: solid 1px #ddd;
}
img.leftalign {
float: left;
margin-right: 8px;
}
img.rightalign {
float: right;
margin-left: 8px;
}
h1#sitename {
display: block;
padding: 5px 70px 0 50px;
color: #fff;
}
#sitename a,
#sitename a:visited,
#sitename a:hover {
color: #fff;
text-decoration: none;
}
#left h2 {
color: #158c59!important;
}
blockquote {
background: #efefef;
padding: 5px;
border: solid 1px #ddd;
display: block;
margin: 5px;
}
blockquote.leftalign {
width: 300px;
float: left;
}
.post ul,
.post ol {
margin-bottom: 15px;
}
.post li {
padding: 3px;
}
<div id="wrap">
<div id="content">
<div id="left">
<div class="columns">
<div class="col1">
<h3 class="subhead">Strategic Reinvention Plan</h3>
<p>WHEDA is always working to stay current and look towards how we can best succeed in the future.
Click here to view the presentation by our leadership, presented at the last all staff meeting.</p>
</div>
<div class="col3">
<h3 class="subhead">New Employees</h3>
<p>Welcome to 
Ging Skievaski on our Risk & Compliance team and 
Michael Clark on our Information Technology team!
<br/>
<br/>
<br/>
</p>
</div>
<div class="col2">
<h3 class="subhead">2016 Board Meeting Schedule</h3>
<p>Remember, you can't wear jeans on days that the WHEDA board is meeting. The 2016 meeting schedule is:</p>
<p><strike>February 17</strike>
<br/>April 20
<br/>June 15
<br/>August 17
<br/>October 19
<br/>December 21 </p>
</div>
</div>
<div class="clear2"></div>
<br/>
<div class="post">
<h2>WHEDA Logo Files</h2>
<p>Logo for Use in Partner Publications - <b>All logo use must follow our Brand Standards </b>
<br/>(Right click and select Save As)</p>
<table dropzone="copy" style="text-align: center; width: 100%; border-spacing: 0px; border-collapse: collapse;">
<tbody>
<tr>
<td style="cursor: default;">
<img src="https://www.wheda.com/assets/0/81/90/179/646ddd39-3e15-4bb2-8efb-5c90f4eceb24.jpg" alt="Main Logo JPG" title="Main Logo JPG" class="fancy" width="300px" draggable="true" /> </td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="sidebar">
<h2>Quick Links</h2>
<ul>
<li>
Employee Suggestion Box
</li>
<li><i>Suggestion Box Tracker</i>
</li>
<li>
Submit a Help Desk Ticket
</li>
<li>
Submit a Marketing Ticket
</li>
<li>
Applications
</li>
</ul>
<h2>Resources</h2>
<ul>
<li>
ADP
</li>
<li>
DocFinity Information
</li>
<li>
Salesforce Login
</li>
<li>
Wisconsin eGov Portal
</li>
<li>
State of Wisconsin Phone/Email Directory
</li>
<li>
WHEDAGear Online Store
</li>
<li>
Loan Committee Schedule
</li>
<li>
Travel Expense Reimbursement
</li>
<li>
Travel Policy
</li>
<li>
Loan Policy
</li>
<li>
Communications & Social Media Policy
</li>
<li>
Whistleblower/Ethics Hotline - FAQs
</li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
You could try giving them all margin-top:0px and padding-top:0px just incase something somewhere else is adding margin or padding.
Failing that you could also try popping !important tags on those.
If you inspect your elements by right clicking then choosing "Inspect element" you might be able to find the source of the problem.
It could also be that they just need floating left or right!

List Item First Indentation Not Lining Up

In each list item I have a text box within a div element.
<html>
<body>
<!-- Window -->
<div id="sample_container_id">
<div class="bucket" id="defaultBucket">
<h3>Default Bucket</h3>
<input type="button" value="Add" class="button">
<div class="innerBucket">
<ul id="tasks">
<li>
<div class="TaskDiv">
<input type="text" class="TaskTextInput">
</div>
</li>
<li>
<div class="TaskDiv">
<input type="text" class="TaskTextInput">
</div>
</li>
<li>
<div class="TaskDiv">
<input type="text" class="TaskTextInput">
</div>
</li>
</ul>
</div> <!-- innerBucket -->
</div> <!-- defaultBucket -->
</div>
</body>
</html>
This is the result:
body
{
background-color: #F8F8F8;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
font-weight: normal;
line-height: 1.2em;
margin: 15px;
}
h1, p
{
color: #333;
}
#sample_container_id
{
width: 100%;
height: 400px;
position: relative;
border: 1px solid #ccc;
background-color: #fff;
margin: 0px;
}
.innerBucket
{
width: 290px;
height: 355px;
margin-top: 40px;
margin-left: 5px;
position: relative;
background-color: white;
}
.bucket
{
width: 300px;
height: 400px;
background-color: #ddd;
position: absolute;
}
.bucket h3
{
float: left;
padding-left: 10px;
padding-top: -10px;
}
.bucket ul
{
margin: 0;
padding-left: 30px;
position: relavtive;
list-style: none;
}
.bucket ul li
{
margin: 0;
padding: 0;
text-indent: 0.5em;
margin-left: -0.5em;
display: block;
position: relative;
}
.bucket .button
{
background-color:#fbb450;
border:1px solid #c97e1c;
float: right;
margin: 5px;
display:inline-block;
color:#ffffff;
font-family:Trebuchet MS;
font-size:17px;
font-weight:bold;
padding:2px 11px;
text-decoration:none;
text-shadow:0px 1px 0px #8f7f24;
}
Result
As you may notice the first item is indented, and I would like the list items to all be aligned on the left. How do I fix this with the CSS (there probably is a lot of things wrong with my CSS, I was trying everything)?
EDIT
I added some more code. You should be able to replicate the problem now.
I didn't want to post a wall of code :)
Solution
I found the solution to the problem. The problem was actually the <h3> element. The bottom margin was forcing the first element off to the side.
Adding this fixed the problem:
.bucket h3
{
...
margin-bottom: 0;
}
Don't float the divs, if you do make sure to clear them or you get
what FakeRainBrigand got in his pen.
Spell relative right For that
matter take the positioning out of that code, it's pointless.
list items by definition are block elements, you don't need to declare
that either.
Close your input tags.
The float is likely the issue, pushing the divs against some invisible element.
.TaskDiv
{
margin: 0;
padding: 0;
}
ul
{
margin: 0;
padding-left: 30px;
list-style: none;
}
ul li
{
margin: 0;
padding: 0;
text-indent: 0.5em;
margin-left: -0.5em;
}
Example: http://jsfiddle.net/calder12/Yw4tB/
I found the solution to my own problem. The issue was the margin of the header forcing the div over (see the end of my question). The solution was simple once I figured that out.
Simply adding this to the h3 styling fixed my problem:
margin-bottom: 0;