I am unable to apply CSS to style my <div> element

I've run into a snag with my coding project, specifically when attempting to style my div. Here is the code I have so far:

All CSS rules are applying correctly except for the .chat rule.

Can someone help me figure out what I'm doing wrong?

var main = function() {
    $('.the-icon-menu').click(function() {
        $('.menu').animate({
            left: "0px"
        }, 200);
        $('body').animate({
            left: "300px"
        }, 200);
    });
    $('.the-icon-close').click(function() {
        $('.menu').animate({
            left: "-300px"
        }, 200);
        $('body').animate({
            left: "0px"
        }, 200);
    });
};
$(document).ready(main);
body {
    left: 0;
    margin: 0;
    overflow: hidden;
    position: relative;
    background-color: #000000;
}
.menu {
    background-color: #FF0000;
    left: -300px;
    height: 100%;
    position: fixed;
    width: 300px;
}
.menu ul {
    border-top: 2px dotted #CE9429;
    list-style: none;
    margin: 0;
    padding: 0;
}
.menu li {
    border-bottom: 2px dotted #CE9429;
    line-height: 45px;
    padding-bottom: 3px;
    padding-left: 20px;
    padding-top: 3px;
}
.menu a {
    color: #CE9429;
    font-size: 15px;
    text-decoration: none;
    text-transform: uppercase;
}
.the-icon-close {
    cursor: pointer;
    padding-left: 10px;
    padding-top: 10px;
}
.the-icon-menu {
    background-color: #FF0000;
    cursor: pointer;
    width: 10px;
    height: 10000px;
}
.chat {
    background-color: #FF0000;
    left: 300px;
    height: 100px;
    position: fixed;
    width: 300px;
}
<div class="menu">
    <div class="the-icon-close">
        <img src="close.png" />
    </div>
    <ul>
        <li><a href="#">Games</a></li>
        <li><a href="#">History of computer games</a></li>
        <li><a href="#">Coding</a></li>
        <li><a href="#">Help forums</a></li>
    </ul>
</div>
<div class="the-icon-menu">
</div>
<div class="the-chat-menu">
    hi
</div>
<div class="chat">
    <div class="the-chat-close">
    </div>
    <form>
        <input type="text" />
        <input type="submit" value="Submit" />
    </form>
</div>

Answer №1

To make the chat box visible, simply add a top or bottom position to the CSS of the .chat element such as top: 0;.

Check out this JSFiddle demo for reference.

By giving the chat div a top or bottom position, you'll be able to see it on the screen.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Triggering a JavaScript function when a page is focused due to user interaction

In my project, I have a specific requirement that involves triggering a new window to open when the user clicks on an icon. In this new window, the user should be able to view and edit certain fields. Upon closing the new window and returning to the parent ...

Position a div adjacent to a particular, changing Rails component once jQuery has toggled it

Within my Rails application (which is utilizing Bootstrap's grid system), I am featuring a blog post within the left column. On the right side, I have integrated a jQuery toggle effect to reveal a quick form for user interaction such as leaving commen ...

"Troubleshooting: Why is the jQuery Mobile loading spinner failing to

                Creating a jQuery Mobile application in DreamweaverCS6. The app includes an unordered list with multiple links that lead to HTML pages containing quizzes. Each quiz page is a jQuery Mobile page with a JavaScript file handling the q ...

AngularJS - A guide on adding a new property to every object within an array

I'm looking to update each item in an array by pushing a scope variable into it. This is my current code: $scope.ProcessExcel = function (data) { //Read the Excel File data. var workbook = XLSX.read(data, { type: 'bin ...

Scroll horizontally through a dynamically sized div with fluid width using jQuery, pause at the beginning and end, and retrieve the width of the

It seems like what I really need is a customized jquery slider, as the ones I've experimented with (caroufredsel, elastislide, smoothdivscroll) don't quite meet my requirements. Many of them come with unnecessary extra features that I don't ...

Challenges with creating an increment and decrement form component using Vue

I've been working on this for almost three days now. My goal is to create a reusable component in Vue that allows a passed value to be incremented and decremented with the click of a button, and then submitted in a form. Below is my code: Parent Com ...

Webpack attempting to load build.js from a nested folder

I am in the process of setting up a Vue app with Vuetify and Vue Router. Everything works fine when I load the base URL "/", and I can easily navigate to /manage/products. However, if I try to directly access /manage/products by typing it into the address ...

Inter-component communication within nested structures in Angular 2

Working on an Angular2 project that involves multiple nested components, I have successfully sent data from a child component to its immediate parent. However, when dealing with three levels of nesting, the question arises: How can I send or modify data ac ...

HTML formatting for text

I recently created an HTML website using Dreamweaver. I faced an issue while trying to design a section within an article using tables to incorporate both text and images. Unfortunately, the tables did not have rounded edges as I desired. I am reaching out ...

Creating a sliding menu using React and Headless UI (with Tailwind CSS)

Currently, I'm in the process of developing a slide-over navigation bar or slide menu that features panels opening on top of each other (I'm still searching for the most accurate way to describe it). The main concept revolves around having a sli ...

What is the best way to execute a function based on the width of the screen?

Two functions need to be called based on the screen width. Here is one attempt: var winWidth = $(window).width(); var sections = function() { $('.image').each(function(){ var $this = $(this), x = $this.find('img'). ...

concealing directory titles within HTML and AJAX

What are the potential security risks associated with exposing PHP folder names? If there are risks, what methods can be used to conceal the folder names within html hyperlinks and ajax code? ...

Chakra UI Not Displaying Proper Responsiveness on the User Interface

I recently integrated Chakra UI for styling a project on Next.js, and while most components are functioning properly, I am facing challenges with implementing responsive layouts. The styles do not seem to adapt when the screen size is reduced. Here's ...

How is UI Router Extras causing unexpected errors in my unit tests?

QUESTION: - I am facing failures in my tests after installing ui-router-extras. How can I resolve this issue? - Is there a way to use ui-router-extras without causing test failures? If you want to quickly install this, use yeoman along with angular-full ...

Conceal the ::before pseudo-element when the active item is hovered over

Here is the code snippet I am working with: <nav> <ul> <li><a href="javascript:void(0)" class="menuitem active">see all projects</a></li> <li><a href="javascript:void(0)" class="menuitem"> ...

Icons in small circles surrounding text in HTML

I am trying to add a small icon or image next to my HTML code on a webpage, but I can't seem to get it to display properly. Currently, the image is showing above the code instead of beside it. How can I adjust my code to achieve this? Below is the cod ...

Amchart 5: Tracking Cursor Movement on the X Axis

I am a beginner with amCharts5 and I am in need of assistance to retrieve the actual X value of the cursor on my chart (where the X axis represents dates). I have come across helpful examples for amCharts 4, but nothing seems to work for amCharts 5. Is thi ...

HTML: Ensure that a user fills out a minimum of one text box before submission

<tr><td> First Name: </td><td><input type="text" name="FirstName" required></td> </tr> <tr><td> Last Name: </td><td><input type="text" name="LastName" required> </td></tr> ...

When utilizing div.load, jQuery and other JavaScript sources may not be defined

When you load a page using jQuery load: $("#myDiv").load("page.php",{foo: bar}); The head section is included in the index: <head> <script src="/assets/plugins/jQuery/jQuery-2.1.4.min.js"></script> <script src="/assets/plugi ...

JasmineJS: manipulating the DOM to achieve the desired outcome

Currently, I am in the process of writing unit tests for a function that requires fetching values from the DOM for processing. getProducts: function() { //Creating query data var queryData = {}; var location = this.$('#location').val(); ...