how to fix element position and and make it responsive - css

I have a html, css and js:
$(document).ready(function() {
$('#friends-chats-noti-button').on("click", function(e, data) {
// TOGGLE (SHOW OR HIDE) NOTIFICATION WINDOW.
$('#friends-chats').fadeToggle('fast', 'linear', function() {
if ($('#friends-chats').is(':hidden')) {}
});
});
});
/* friends chats */
#friends-chats-container {
position:relative;
margin-right:10px;
margin-left:10px;
}
/* A CIRCLE LIKE BUTTON IN THE TOP MENU. */
#friends-chats-noti-button {
width:22px;
height:22px;
line-height:22px;
cursor:pointer;
}
/* THE NOTIFICAIONS WINDOW. THIS REMAINS HIDDEN WHEN THE PAGE LOADS. */
#friends-chats {
display:none;
width:900px;
top:55px;
right:10%;
background:#FFF;
border:solid 1px rgba(100, 100, 100, .20);
-webkit-box-shadow:0 3px 8px rgba(0, 0, 0, .20);
z-index: 1000;
}
/* AN ARROW LIKE STRUCTURE JUST OVER THE NOTIFICATIONS WINDOW */
#notifications:before {
content: '';
display:block;
width:0;
height:0;
color:transparent;
border:10px solid #CCC;
border-color:transparent transparent #fff;
margin-top:-20px;
margin-left:345px;
}
#friends-chats:before {
content: '';
display:block;
width:0;
height:0;
color:transparent;
border:10px solid #CCC;
border-color:transparent transparent #fff;
margin-top:-20px;
margin-left:870px;
}
.messaging { padding: 0 0 50px 0;}
.msg_history {
height: 516px;
overflow-y: auto;
}
#chat-message-input-private
{
margin: 1% 0 1% 1%;
width: 80%;
height: 68px;
font-size: 18px;
}
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<nav class="navbar navbar-default">
<ul class="nav navbar-nav navbar-right">
<li id="friends-chats-container">
<div id="friends-chats-noti-button">
<i class="fa fa-comments-o fa-2x" aria-hidden="true"></i>
</div>
<div>
<p> other element </p>
</div>
<div id="friends-chats">
<div class="container">
<h3 class=" text-center">Messaging</h3>
<div class="messaging">
<div class="inbox_msg">
<div class="inbox_people">
<div class="headind_srch">
<div class="recent_heading">
<h4>Recent</h4>
</div>
</div>
<div class="inbox_chat" id="inbox_chat">
</div>
</div>
<div class="mesgs">
<div class="msg_history" id="msg_history">
</div>
<div class="inputContainer">
<input id="chat-message-input-private" autocomplete="off" placeholder="Type your message...">
</div>
</div>
</div>
</div>
<!---->
</div>
</div>
</li>
</ul>
</nav>
<div>some element</div>
<div>some element</div>
<div>some element</div>
<div>some element</div>
<div>some element</div>
as you can see, there is a message icon on top-right side of the page.
what i want to get is
when click the message icon, the message window will pop out and don't impact other element's position.
when narrow the window, the message window can be responsive.
i already try several hours, but still haven't get good result, please help me. thanks everyone.

I think you forgot about adding the line position: abosolute;
I added it for you here. And I made the popup smaller so that you can see clearly
$(document).ready(function() {
$('#friends-chats-noti-button').on("click", function(e, data) {
// TOGGLE (SHOW OR HIDE) NOTIFICATION WINDOW.
$('#friends-chats').fadeToggle('fast', 'linear', function() {
if ($('#friends-chats').is(':hidden')) {}
});
});
});
/* friends chats */
#friends-chats-container {
position:relative;
margin-right:10px;
margin-left:10px;
padding: 0 15px;
}
/* A CIRCLE LIKE BUTTON IN THE TOP MENU. */
#friends-chats-noti-button {
width:22px;
height:22px;
line-height:22px;
cursor:pointer;
}
/* THE NOTIFICAIONS WINDOW. THIS REMAINS HIDDEN WHEN THE PAGE LOADS. */
#friends-chats {
display:none;
width:600px;
top:55px;
right:10%;
background:#FFF;
border:solid 1px rgba(100, 100, 100, .20);
-webkit-box-shadow:0 3px 8px rgba(0, 0, 0, .20);
z-index: 1000;
position: absolute;
}
/* AN ARROW LIKE STRUCTURE JUST OVER THE NOTIFICATIONS WINDOW */
#notifications:before {
content: '';
display:block;
width:0;
height:0;
color:transparent;
border:10px solid #CCC;
border-color:transparent transparent #fff;
margin-top:-20px;
margin-left:345px;
}
#friends-chats:before {
content: '';
display:block;
width:0;
height:0;
color:transparent;
border:10px solid #CCC;
border-color:transparent transparent #fff;
margin-top:-20px;
margin-left:870px;
}
.messaging { padding: 0 0 50px 0;}
.msg_history {
height: 516px;
overflow-y: auto;
}
#chat-message-input-private
{
margin: 1% 0 1% 1%;
width: 80%;
height: 68px;
font-size: 18px;
}
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<nav class="navbar navbar-default">
<ul class="nav navbar-nav navbar-right">
<li id="friends-chats-container">
<div id="friends-chats-noti-button">
<i class="fa fa-comments-o fa-2x" aria-hidden="true"></i>
</div>
<div>
<p> other element </p>
</div>
<div id="friends-chats">
<div class="container">
<h3 class=" text-center">Messaging</h3>
<div class="messaging">
<div class="inbox_msg">
<div class="inbox_people">
<div class="headind_srch">
<div class="recent_heading">
<h4>Recent</h4>
</div>
</div>
<div class="inbox_chat" id="inbox_chat">
</div>
</div>
<div class="mesgs">
<div class="msg_history" id="msg_history">
</div>
<div class="inputContainer">
<input id="chat-message-input-private" autocomplete="off" placeholder="Type your message...">
</div>
</div>
</div>
</div>
<!---->
</div>
</div>
</li>
</ul>
</nav>
<div>some element</div>
<div>some element</div>
<div>some element</div>
<div>some element</div>
<div>some element</div>

Related

Showing article header outside container with background image

I'm working on a specific layout using Bootstrap 5 and attempt to render a tag outside his original container, taking the full page width.
I tried using absolute position on the img tag, however, doing this, footer is going over the tag which is not expected.
More than words, this is what I trying to do
The ideal DOM structure would be as follow :
<article>
<header>
<div>
<img />
<h3 />
</div>
<div class="meta" />
</header>
<div class="content" />
<footer />
</article>
img should get full x-width
img should stay in the overal y position (meaning nothing coming after it - should go over it, like a page footer or anything else)
h3 should be over the img tag
any idea would get a warm welcome, I'm trying to make that small thing working since over a week now :')
you're right
my current best attempt it this, so I split the overall structure in three distinct container box, which sounds like a bit hacky to me - and I have issues when it's rendered on mobile (ie: title is going outside down the box, instead staying stick to the bottom of the image)
<body class="position-relative">
<div class="container-fluid container-lg">
<header class="mt-5">
<nav class="navbar navbar-expand-lg navbar-dark mt-5 mb-3"></nav>
</header>
</div>
<main class="mt-5 mb-3" role="main">
<section>
<article>
<header>
<div class="go-article-banner d-flex position-relative">
<img style="object-fit: cover;position: absolute;height: 300px;left: 0;right: 0;/*! width: 200%; */" class="w-100" src="...">
<div class="container-fluid container-lg position-relative">
<div class="position-absolute bottom-0 start-0 right-0" style="background: rgba(0, 0, 0, 0.4);">
<h3 class="display-3 p-4">The War of the Worthies: the spectre of Cardan’s aggression</h3>
</div>
</div>
</div>
</header>
<div class="container-fluid container-lg"></div>
<footer class="container-fluid container-lg"></footer>
</article>
</section>
</main>
<div class="container-fluid container-lg">
<footer>
<div class="go-streaming-news d-none d-sm-block mb-4">
<div class="row">
<div class="col col-sm-4 col-lg-3 col-xl-2 d-flex justify-content-between text-uppercase" style="background-color: var(--bs-primary); padding: .5rem 1rem;">
<span>Breaking News</span>
<span style="border-right: solid 2px rgb(50, 67, 100)"></span>
<span>21:03</span>
</div>
<div class="col col-sm-8 col-lg-9 col-xl-10 marquee-wrapper">
<div class="marquee"><div style="width: 100000px; animation: 9.64667s linear 0s infinite normal none running marqueeAnimation-39418180; transform: translateX(1084px);" class="js-marquee-wrapper"><div class="js-marquee" style="margin-right: 0px; float: left;">
<ul class="list-inline m-0 p-0">
<li class="list-inline-item">Some news</li>
<li class="list-inline-item">Another news</li>
<li class="list-inline-item">Yet Another news</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</footer>
</div>
</body>
However, the render is good https://imgur.com/a/9wBse0Q
My previous attempt was that one, and with that, the marquee box is going inside the article banner. This, and the title is going outside the image which is rendered using a after anchor.
<body class="position-relative customize-support">
<div class="container-fluid container-lg">
<header class="mt-5">
<nav class="navbar navbar-expand-lg navbar-dark mt-5 mb-3"></nav>
</header>
<main class="mt-5 mb-3" role="main">
<section>
<article>
<header>
<div class="go-article-banner"></div>
<div class="d-flex">
<h3 class="display-3">Change of course for Eskari Industries</h3>
</div>
</header>
<div></div>
<footer></footer>
</article>
</section>
</main>
<footer>
<div class="go-streaming-news d-none d-sm-block mb-4">
<div class="row">
<div class="col col-sm-4 col-lg-3 col-xl-2 d-flex justify-content-between text-uppercase" style="background-color: var(--bs-primary); padding: .5rem 1rem;">
<span>Breaking News</span>
<span style="border-right: solid 2px rgb(50, 67, 100)"></span>
<span>21:03</span>
</div>
<div class="col col-sm-8 col-lg-9 col-xl-10 marquee-wrapper">
<div class="marquee">
<div style="width: 100000px; animation: 9.64667s linear 0s infinite normal none running marqueeAnimation-33044180; transform: translateX(1084px);" class="js-marquee-wrapper">
<div class="js-marquee" style="margin-right: 0px; float: left;">
<ul class="list-inline m-0 p-0">
<li class="list-inline-item">Some news</li>
<li class="list-inline-item">Another news</li>
<li class="list-inline-item">Yet Another news</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</footer>
</div>
</body>
/*
Theme Name: Galaxy One
Theme URI: https://galaxyone.news
Author: Loic Leuilliot
Author URI: https://github.com/warlof
Description: Galaxy One Gazette default template
Tags: newspaper, rising constellation, game, news
Version: 0.1
Requires at least: 5.0
Tested up to 5.4
Requires PHP: 7.0
License: GNU General Public License v2 or Later
License URI: https://www.gnu.org/Licenses/gpl-2.0.html
Text Domain: galaxyone
*/
#font-face {
font-family: "Gtek Technology";
src: url("./assets/fonts/Gtek Technology.ttf") format('truetype');
font-weight: bold;
}
header h1 {
font-size: calc(1.375rem + 3vw);
font-family: "Gtek Technology", sans-serif;
margin-bottom: 0;
border-bottom: solid 4px var(--bs-primary);
}
.navbar-nav {
width: 100%;
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
}
.navbar-nav > li {
flex-grow: 1;
}
.navbar-nav .nav-link {
text-align: center;
text-transform: uppercase;
padding: .7rem 1rem;
border-top: 1px solid var(--bs-primary);
border-bottom: 1px solid var(--bs-primary);
}
.navbar-dark .navbar-nav .nav-link:hover, .navbar-dark .navbar-nav .nav-link:focus {
color: var(--bs-primary);
}
.navbar-dark .navbar-nav .show > .nav-link, .navbar-dark .navbar-nav .nav-link.active {
color: #fff;
background-color: var(--bs-primary);
}
.go-news .card-img-top {
height: 250px;
object-fit: cover;
object-position: 50% 0;
}
.go-news .stretched-link:hover::after {
background: #282c34dd url("./assets/img/plus-circle.svg") center no-repeat;
background-size: 50%;
transition: background-color 0.5s ease;
}
.go-category-link {
border-radius: 0;
border: none;
padding: 0.5rem;
text-transform: uppercase;
text-decoration: none;
}
.go-category-link.category-sport {
background-color: var(--bs-primary);
}
.go-category-link.category-politics {
background-color: var(--bs-danger);
}
.go-category-link.category-financial, .go-category-link.category-people {
background-color: var(--bs-warning);
}
.go-category-link.category-miscellaneous {
background-color: var(--bs-success);
}
.go-category-link.category-sciences {
background-color: var(--bs-secondary);
}
.page-item {
margin-right: 20px;
}
.page-item:last-child {
margin-right: 0;
}
.page-item:first-child .page-link {
border-radius: 0;
}
.page-item:last-child .page-link {
border-radius: 0;
}
.page-item.disabled .page-link {
background-color: var(--bs-primary);
border-color: var(--bs-primary);
color: #fff;
}
.page-link {
background-color: transparent;
border-color: var(--bs-primary);
color: rgba(255,255,255,0.55);
}
.page-link:hover {
color: var(--bs-primary);
}
.page-link.dots:hover {
background-color: transparent;
border-color: var(--bs-primary);
color: rgba(255,255,255,0.55);
cursor: default;
}
.go-article-banner {
height: 300px;
}
.go-article-banner::after {
background: #333 url('...') no-repeat center;
background-size: cover;
content: "";
position: absolute;
height: 300px;
left: 0;
right: 0;
}
.go-streaming-news .marquee-wrapper {
background-color: #4472c455;
padding: 0.5rem;
}
.go-streaming-news .marquee {
overflow: hidden;
}
.go-streaming-news .marquee .list-inline-item {
border-right: solid 3px var(--bs-primary);
margin: 0;
padding: 0 0.5rem;
}
.go-streaming-news .marquee .list-inline-item:last-child {
border-right: none;
}
Well, I finally figure a way to do it properly (I think so at least).
Overall reference is this blog post https://css-tricks.com/full-width-containers-limited-width-parents/
I'm using the very last alternative as detailed by "No calc() needed" which is probably the more flexible solution.
First, here is the global DOM structure
<div class="container-fluid container-lg">
<header>
<nav></nav>
</header>
<article>
<header>
<div class="go-article-header">
<div class="go-article-banner" style="background-image: url('...');"></div>
<div class="go-article-title-wrapper">
<h3 class="display-3 m-0">Article title</h3>
</div>
</div>
</header>
<div class="go-article-content">
<p>...</p>
</div>
<footer></footer>
</article>
<footer></footer>
</div>
We have a unique container which is covering the overall page
Inside this container, there are a global header and footer with navigation inside the header
Between both, we have an article, container its own header and footer
The header is containing a few wrapper for extra styling (like background under title, and so on) - I also switched from img tag to a background in order to be able to use cover property. But here again, it's much more a design choice
Now, the styling :
.go-article-header {
height: 300px;
position: relative;
}
.go-article-banner {
position: relative;
left: 50%;
right: 50%;
width: 100vw;
height: 100%;
margin-left: -50vw;
margin-right: -50vw;
background-image: url("assets/img/eskari.png");
background-color: #333;
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
.go-article-title-wrapper {
background-color: rgba(0, 0, 0, 0.6);
position: absolute;
left: 0;
right: 0;
bottom: 0;
padding: 1rem;
}
Everything is happening with the .go-article-banner class which is first aligning the tag (using the left and right properties) and then make it start outside the box (using the margin properties). Last but not least, the width property using view width metric is ensuring the tag will use the full screen width.
Regarding title, we just need to fix it left/right/down using parent container. This is done with the .go-article-title-wrapper class.
Here is the final render

how to keep image in their responsive div

How do I keep the two images contained in their responsive divs as I change the browser size?
.entry-header{
display:none;
}
#masthead{
height:12vw;
}
html{
height:55vw;
}
body{
height:53vw;
margin-top:2vw;
}
#page{
height:51.5vw;
/*border:solid 2px black;*/
}
#vision-table{
display:table;
margin:1.3509375vw 0;
/* border:solid 2px black; */
}
#vision{
background-color:#538231c7;
color:white;
height:3.71385vw;
padding:1.00215vw 2.01vw;
line-height:1.25;
font-size:1.5vw;
display:table-cell;
vertical-align:middle;
}
.row{
display: flex; /* equal height of the children */
justify-content:space-between;
/* border:solid 2px black;*/
}
.col{
/*flex:1; /* additionally, equal width */
width:32%;
background-color:#b3d7f8;
/* border:solid 2px black;*/
}
.col3{
height:6.67vw;
/*border:solid 2px black;*/
}
.top{
height:3.64vw;
/* border:solid 2px black;*/
}
.pic{
height:11.535vw;
border:solid 1px black;
}
.text{
height:8.5vw;
/*border:solid 2px black; */
}
.read{
height:6.67vw;
/* border:solid 2px black; */
}
#footer{
text-align:center;
}
.top h1{
font-size:1.6vw;
color:#538232;
text-align:center;
}
.wp-block-image {
line-height: 0;
max-width: 100%;
margin: 0;
text-align:center;
}
img{
width:21vw;
}
figure{
background-size:contain;
}
.pic{
background-size:contain;
}
#media only screen and (max-width: 1110px) {
#masthead{
height:16vw;
}
img{
width:28.639vw;
}
}
<div id="vision-table">
<div id="vision">Our Vision: A sustainable and healthy town of Weston, with engaged citizens committed to a thriving community, today and in the future.</div>
</div>
<div class="row">
<div id="col1" class="col">
<div class="top">
<h1>Feature Highlight</h1>
</div>
<div class="pic">
<figure class="wp-block-image">
<img src="https://sustainablewestonma.000webhostapp.com/wp-content/uploads/2019/08/Gas-Leak-Infographic--e1566766035812.png"></figure>
</div>
<div class="text"></div>
<div class="read"></div>
</div>
<div id="col2" class="col">
<div class="top">
<h1>Feature Action</h1>
</div>
<div class="pic">
<figure class="wp-block-image">
<img src="https://sustainablewestonma.000webhostapp.com/wp-content/uploads/2019/08/60805048_10217029527561784_8914643229203234816_n-1-e1566764730232.jpg"></figure>
</div>
<div class="text"></div>
<div class="read"></div>
</div>
<div id="col3" class="col">
<div class="col3 top">
<h1>Get Involved</h1>
</div>
<div class="col3 gi-button"></div>
<div class="col3 gi-button"></div>
<div class="col3 gi-button"></div>
<div class="col3 gi-button"></div>
</div>
</div>
Try this with images to make sure images never cross their container
.wp-block-image img {
max-width: 100%;
width: auto\9;
height: auto;
vertical-align: middle;
border: 0;
-ms-interpolation-mode: bicubic;
}

How to position overlay above the photo?

I am trying to make the overlap appear on top of the photo instead of under it. Here is a link to my test page - http://kaniamea.com/image.htm
How can I position this correctly and be responsive in the same time?
And here is the code:
<div align="center">
<div class="image-container"> <a href="link"><img src="https://www.hawaiidiscount.com/Portals/0/Skins/HD-custom-design-s/images/activities/oahu_dinner.jpg" height="174" width="231">
<div class="after">This is some content</div>
</a> </div>
<div class="image-container"> <a href="link"><img src="https://www.hawaiidiscount.com/Portals/0/Skins/HD-custom-design-s/images/activities/oahu_dinner.jpg" height="174" width="231">
<div class="after">This is some content</div>
</a> </div>
<div class="image-container"> <a href="link"><img src="https://www.hawaiidiscount.com/Portals/0/Skins/HD-custom-design-s/images/activities/oahu_dinner.jpg" height="174" width="231">
<div class="after">This is some content</div>
</a> </div>
<style>
.image-container {
width:230px;
height:200px;
display:inline-block;
vertical-align:top;
margin-top:4px;
}
.image-container .after {
width:230px;
height:200px;
display:inline-block;
vertical-align:top;
margin-top:4px;
position:absolute;
display: none;
color: #FFF;
}
.image-container:hover .after {
display: block;
background: rgba(0, 0, 0, .6);
}
</style>

position overlaying div within another div

I've got some 'person' divs in a 'main' div. On 'person':hover I show an overlaying div. I want it appear only within the 'main' div, not go beyond 'main's boundaries.
This way:
When cursor over AGCH div
When cursor is over JALO div
I want Jack London's right border aligned with main's right border.
The complete example here: https://jsfiddle.net/yjdrnk9o/1/
HTML
<div id="main">
<div class="person">
<span class="short-name">WISH</span>
<div class="more">
<span>William</span>
<span>Shakespeare</span>
</div>
</div>
<div class="person">
<span class="short-name">AGCH</span>
<div class="more">
<span>Agatha</span>
<span>Christie</span>
</div>
</div>
<div class="person">
<span class="short-name">JALO</span>
<div class="more">
<span>Jack</span>
<span>London</span>
</div>
</div>
</div>
CSS
#main {
position: relative;
border: 1px solid;
width: 150px;
height: 100px;
}
.person {
float:left;
border:1px solid;
margin:1px 2px;;
}
.person:hover>.more {
display: block !important;
}
.more {
z-index:1;
position:absolute;
white-space: nowrap;
background-color:gray;
}
Thank you
Like this? https://jsfiddle.net/yjdrnk9o/3/
I added a class to your html to distinguish the last .person from the others and then said that the .more child of the .person.right element should be aligned to the right.
#main {
position: relative;
border: 1px solid;
width: 150px;
height: 100px;
}
.person {
float:left;
border:1px solid;
margin:1px 2px;;
}
.person:hover>.more {
display: block !important;
}
.more {
z-index:1;
position:absolute;
white-space: nowrap;
background-color:gray;
}
.person:last-of-type .more {
right: 0;
}
<div id="main">
<div class="person">
<span class="short-name">WISH</span>
<div style="display:none;" class="more">
<span>William</span>
<span>Shakespeare</span>
</div>
</div>
<div class="person">
<span class="short-name">AGCH</span>
<div style="display:none;" class="more">
<span>Agatha</span>
<span>Christie</span>
</div>
</div>
<div class="person on-right">
<span class="short-name">JALO</span>
<div style="display:none;" class="more">
<span>Jack</span>
<span>London</span>
</div>
</div>
</div>
use :last-of-type or :nth-of-type(3)
#main {
position: relative;
border: 1px solid;
width: 150px;
height: 100px;
}
.person {
float:left;
border:1px solid;
margin:1px 2px;;
}
.person:hover>.more {
display: block !important;
}
.more {
z-index:1;
position:absolute;
white-space: nowrap;
background-color:gray;
}
.person:last-of-type .more{
right: 0;
}
<div id="main">
<div class="person">
<span class="short-name">WISH</span>
<div style="display:none;" class="more">
<span>William</span>
<span>Shakespeare</span>
</div>
</div>
<div class="person">
<span class="short-name">AGCH</span>
<div style="display:none;" class="more">
<span>Agatha</span>
<span>Christie</span>
</div>
</div>
<div class="person">
<span class="short-name">JALO</span>
<div style="display:none;" class="more">
<span>Jack</span>
<span>London</span>
</div>
</div>
</div>

Strange css floating behaviour

Why is the professor div not floating to the left? It is "hanging up" on the members container. The main container containing all of the red divs does not have a set height so the professor div has room to go to the left so to say. The divs are set to float left in case it wasn't apparent. I know what's wrong, How do I fix it?
<div id="displayEventInfoDiv">
<div class="eventInfoDiv">
<p id="infoClassTitle" class="eventInfoTitle">Class:</p>
<p id="infoClassP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoLocationTitle" class="eventInfoTitle">Location:</p>
<p id="infoLocationP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoTimeTitle" class="eventInfoTitle">Time:</p>
<p id="infoTimeP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoToolsTitle" class="eventInfoTitle">Tools:</p>
<p id="infoToolsP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoMessageTitle" class="eventInfoTitle">Message:</p>
<p id="infoMessageP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoMembersTitle" class="eventInfoTitle">Members:</p>
<p id="infoMembersP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoSectionTitle" class="eventInfoTitle">Section:</p>
<p id="infoSectionP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoNumberTitle" class="eventInfoTitle">Course Number:</p>
<p id="infoNumberP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoProfessorTitle" class="eventInfoTitle">Professor:</p>
<p id="infoProfessorP" class="eventInfoP"></p>
</div>
<button id="exitEventInfoDivButton">exit</button>
</div>
#displayEventInfoDiv // main container
{
position:absolute;
width:60%;
left:20%;
padding: 10px 10px 40px 10px;
background-color: rgba(0,0,0,0.7);;
border-radius: 10px;
display:none;
z-index: 30;
}
#exitEventInfoDivButton // exit button
{
position:absolute;
bottom:10px;
right:10px;
height:30px;
width:80px;
background-color: rgba(255,255,255,0.4);
font-size:20px;
color:black;
border-radius: 10px;
border:none;
outline:none;
font-family: 'Indie Flower', cursive;
cursor:pointer;
}
.eventInfoDiv // red div
{
width:200px;
float:left;
padding: 0 10px 0 10px;
background-color:red;
border:3px solid black;
}
.eventInfoTitle //titles
{
height:30px;
width:100%;
font-size:25px;
color:white;
text-align:center;
margin:0 0 20px 0;
}
.eventInfoP // info under titles
{
width:100%;
border-radius: 10px;
text-align:center;
font-size:20px;
background-color: rgba(255,255,255,0.4);
padding: 10px 0 10px 0;
}
I would either add an extra class to members to resize it properly, so you're Professor div is not sitting next to it because of float: left.
Or target you're professor div and set it to: clear:both
You can do this by using
<div class="eventInfoDiv professor">
<p id="infoProfessorTitle" class="eventInfoTitle">Professor:</p>
<p id="infoProfessorP" class="eventInfoP"></p>
</div>
.professor {
clear: both;
}

Resources