The crimson container fails to appear; rather, it is replaced by a slender strip

Upon observing the image, it is clear that the red box has transformed into a line. Even after setting the height to 300px, there seems to be no impact on the image whatsoever. I initially configured the height to 200px within the div and ul tags of the CSS page.

Unfortunately, I am unable to upload an image to showcase the issue.

HTML PART:

<!DOCTYPE html>
<html>
<head>
    <title>multiple box</title>
    <link rel="stylesheet" type="text/css" href="test22.css">
</head>
<body>
    <div class="div1">
        <ul>
            <li><img src="chicken.jpg"/></li>
            <li><img src="chicken.jpg"/></li>
            <li><img src="chicken.jpg"/></li>
        </ul>
    </div>
</body>
</html>

CSS PART:

body{
    margin: 0px;
    padding: 0px;
}

.div1{
    width: 800px;
    height: 400px;
    border: 1px solid #b4b4b4;
    margin-left: 100px;
    margin-top: 20px;
}

.div1 ul{
    width: 350px;
    height: 200px;
    border-top: 1px solid red;
    margin-left: 100px;
    margin-top: 20px;
    list-style-type: none;
}

.div1 li {
    width: 50px;
    height: 52px;
    border: 1px solid blue;
    float: left; 
}

.div1 img {
    width: 40px;
}

Answer №1

Make sure to use the CSS property "border" instead of just "border-top" to draw a border around the entire box.

body{
    margin: 0px;
    padding: 0px;
}

.div1{
    width: 800px;
    height: 400px;
    border: 1px solid #b4b4b4;
    margin-left: 100px;
    margin-top: 20px;
}

.div1 ul{
    width: 350px;
    height: 200px;
    border: 1px solid red;
    margin-left: 100px;
    margin-top: 20px;
    list-style-type: none;
}

.div1 li {
    width: 50px;
    height: 52px;
    border: 1px solid blue;
    float: left; 
}

.div1 img {
    width: 40px;
}
<!DOCTYPE html>
<html>
<head>
    <title>multiple box</title>
    <link rel="stylesheet" type="text/css" href="test22.css">
</head>
<body>
    <div class="div1">
        <ul>
            <li><img src="chicken.jpg"/></li>
            <li><img src="chicken.jpg"/></li>
            <li><img src="chicken.jpg"/></li>
        </ul>
    </div>
</body>
</html>

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

Tips for making a draggable div come to the forefront upon clicking

I'm looking to make a jQuery draggable div come to the front when it's clicked. I came across this post, and tried creating a JsFiddle based on it, but couldn't get it to work. Any ideas on what I might be missing? Thanks! Here's the l ...

What is the best way to generate a table with continuously updating content?

If the user input : $sgl = 2; $dbl = 0; $twn = 1; $trp = 0; $quad = 0; $price_room = 250000; I want the result looks like the picture below : https://i.sstatic.net/iQYqr.jpg I have tried the following code : <?php $sgl = 2; $dbl = 0; ...

Enhancing Website Design with Image Borders

I'm currently designing a website for a Media Agency and I'm looking to add a Frame-style border that gives the impression of being placed inside a television. The Television Image I have is a PNG file with a solid outer frame and a transparent i ...

How to play audio with a source path that includes the special character "%" in JavaScript

Having an issue with playing an audio file that has '%' in its name. I've tried using the tag <audio src="test%320.mp3" controls></audio>, but it seems like the file is not being found when I try to play it. Can anyone ...

Looking to utilize jQuery for writing and reading data to and from a JSON file?

My goal is to create a JSON file and write data to it without any limitations on entries. I also need to be able to read this data from the file and display it on an HTML page, where I can collect the necessary information. As a newcomer to jQuery, I woul ...

Warning: Datatables encountered an issue with the table ID 'example'

Good day, I am seeking clarification regarding DataTables. In a tutorial, I came across a table that can be edited "inline". I prefer the table to be in German. The code snippet for the table: <script type="text/javascript" language="javascript" ...

The Troubles of Top Margins in CSS

Hey there, I'm a bit stumped on this issue. I've been trying to apply a 10px top margin to a paragraph inside a div, but instead of creating the space I want between elements, it just seems to push the whole containing div down by 10px. Here are ...

Ineffective Implementation of While Loop for Div Visibility

Here's a simple code that generates divs using a while loop. However, it doesn't seem to be working as expected. It's actually just basic HTML, nothing too complex. But for some reason, it's not displaying any of the five divs. <? ...

Combine several CSS classes into a single class for easier styling

I have implemented specific styling on my webpage based on the city or state of the user. For instance, if someone is from New Jersey, the background color will be red. Currently, I am achieving this using the following method: Using a combination of HTML ...

Customize a CSS attribute within Dojo

I am currently working with the enhanced grid in Dojo 1.10 version and I have encountered a simple problem that I am struggling to fix. I need to set a background-color CSS property for a table row, but there is already another background property applied ...

Tips for enabling scrolling for a specific div while disabling scrolling for the entire page

Can the page's scrolling be deactivated while still allowing scrolling for a specific div within the page? ...

I am having trouble placing the button within the image

Essentially, my goal is to place the button within the image and ensure it remains in its position when transitioning to mobile mode or adjusting window size. This is the desired outcome: https://example.com/image https://example.com/button-image .img ...

How can I include multiple search forms on a single page in TYPO3 Ke_Search without any conflicts between them?

In the header of my website, I have a search form that is generated as a cObject from a content element containing a ke_search searchbox. When this form is submitted, it redirects to a /search page. In addition to this, I have subpages that are meant to se ...

Cannot find CSS selector during web scraping operation

I recently started exploring web scraping and I'm currently working on extracting data from the following website: Specifically, I'm focused on extracting information from a particular table. However, the data in this table is not formatted in a ...

Ways to implement pseudo classes to display title text upon button click

Is it possible for the user to input their name and have it appear on the screen once they click the save button? I am using Mantine design framework and want to utilize pseudo classes. However, styling two classes at once seems tricky in Mantine compared ...

Loading input datalist in Firefox postponed

My goal is to implement an input field for a username that allows users to select from a wide range of names/usernames. I want them to be able to enter a partial string from the name or username. Instead of loading the entire list initially, I aim to load ...

Adjust the placement of the outcome on the table using PHP

I am attempting to display 7 results in a table (image 1) and need to adjust their positioning. In the array, Mon = 1 and Sun = 7. Where there are no values, I want them to display as $0. However, I am struggling to move them to the correct spot on the ta ...

The close button is not functioning properly

I created a script to close my div element by clicking on the 'x' icon, but instead of deleting the div only, the whole page gets deleted. I'm not sure where I went wrong, can anyone help me? HTML <div class="note"> <span id ...

The form continues to submit even if the validation process fails

I am facing an issue where my form still submits to the controller even if the validation fails. Here's my jQuery code: $(document).ready(function () { $('#commentForm').validate(); }); $(function () { $('#commentForm&ap ...

Steps to customize the error icon in Material-UI Stepper

I am faced with the task of changing the error icon of a default MUI Stepper, which currently looks like this: https://i.stack.imgur.com/jZlOn.png However, I need it to display the following icon instead: https://i.stack.imgur.com/uTGSw.png Although I am ...