Issues with the arrangement and placement of elements using CSS

Struggling with the layout of a website in CSS after just starting to learn? Take a look at my attempt vs. reality and help me figure out where I'm going wrong...

See my design here! Current state here! html

<!DOCTYPE html>
<html>
<head>
    <link href="https://fonts.googleapis.com/css?family=Catamaran:100|Pontano+Sans|Ruda:900" rel="stylesheet">
    <link href="style.css" type="text/css" rel="stylesheet">
    <title>ALISAN'S OCCASIONS</title>
</head>
<body>
    <div class="header">
    </div>
    <div class="home_page">
        <div class="home_left">
            <ul id="social_media">
                <li><a href="https://www.facebook.com/" target="_blank"><img src="Facebook1.jpg"></a></li>
                <li><a href="https://www.instagram.com/" target="_blank"><img src="Instagram1.jpg"></a></li>
                <li><a href="https://twitter.com/?lang=en" target="_blank"><img src="twitter1.jpg"></a></li>
            </ul>
        </div>
        <div class="home_center">

        </div>
        <div class="home_right">

        </div>
    </div>
</body>
</html>

This is what my CSS looks like:

* {

    box-sizing: border-box;
}


body {

    padding: 0;
    margin: 0;
    background-color: #8799b7;
    overflow-y: scroll;
    max-height: 735px;

} 


.header {

    display: block;
    background-image: url("header4.jpg");
    height: 500px;
}

.home_page {

    display: block;
    margin:0;
    padding: 0;

}

.home_left {

    display: inline-block;
    height: 235px;
    width: 506px;
    margin: 0;
    padding: 0;
}


.home_center {

    display: inline-block;
    height: 235px;
    width: 506px;
    margin: 0;
    padding: 0;
}

.home_right {

    display: inline-block;
    height: 235px;
    width: 506px;
    margin: 0;
    padding: 0;

Answer №1

To simplify your code, consider utilizing the power of flexbox, especially if you're not concerned about supporting older browsers.

The HTML structure would look like this:

<html>
<head>
    <link href="https://fonts.googleapis.com/css?family=Catamaran:100|Pontano+Sans|Ruda:900" rel="stylesheet">
    <link href="style.css" type="text/css" rel="stylesheet">
    <title>ALISAN'S OCCASIONS</title>
</head>
<body>
    <div class="header">
      header
    </div>
    <div class="home_page">
        <div class="home_left">
           left
        </div>
        <div class="home_center">
center
        </div>
        <div class="home_right">
right
        </div>
    </div>
</body>
</html>

For the CSS styling, utilize these properties:

* {

    box-sizing: border-box;
}

body {

    padding: 0;
    margin: 0;
    background-color: #8799b7;
    overflow-y: scroll;
    max-height: 735px;

} 

.header {

    display: block;
    background-image: url("header4.jpg");
    height: 500px;
}

.home_page {

    display: flex;
    margin:0;
    padding: 0;
}

.home_page > div {
  border: 1px solid grey;
}

.home_left {

    height: 235px;
    width: 506px;
    margin: 0;
    padding: 0;
}


.home_center {

    height: 235px;
    width: 506px;
    margin: 0;
    padding: 0;
}

.home_right {

    height: 235px;
    width: 506px;
    margin: 0;
    padding: 0;
}

Check out the live example at: https://codepen.io/anon/pen/EvqXmg

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

HTML5 multi-linking options

Currently, I am enrolled in a beginner's web design course and I have encountered a roadblock. The assignment requires me to create a multi-link at the bottom of the page. Although I have successfully created it, I'm struggling with preventing a ...

When implementing the Slick Carousel with autoplay within an Isotope grid, the height of the image slides may occasionally reduce to 1 pixel when applying filters

I've been struggling with this issue for more than a day now, and despite searching through similar posts and trying their solutions, I still haven't been able to resolve it. Here's an example of the problem: https://jsfiddle.net/Aorus/1c4x ...

Ensure that the hover effect remains on the element that emerges from it

I am facing an issue with a list where each item has a title. Upon hovering over the title, an info box appears but disappears when moving the cursor to the box itself. The requirement is for the box to remain visible even when the cursor moves from the t ...

Exploring the world of colored tab links in CSS

Check out this code: <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>My Unique Page</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.8.3/themes/base/jquery-ui.css" /> ...

Adjust text to fit within a specified height container automatically

Is there a way to make text resize automatically based on the height and width of its container? I've looked at similar questions but none seem to provide the right solution for me. I tried using fitText, but it doesn't take the container's ...

CSS Navigation drop-down menu experiences a shaking problem when the mouse hovers between the first and second link

Hey there, I'm experiencing a strange issue with my navigation bar. When hovering the mouse between the first drop-down link and the second drop-down link, a strange jitter occurs. Can someone provide assistance in resolving this issue? You can witn ...

Troubleshooting Printing Issues on WordPress

After conducting a thorough search on Google to find solutions for this issue, I discovered that most of the fixes are specific to certain themes. While I did come across a suggestion to create a print.css file which partially solved the problem by printin ...

Customize the borders of breadcrumb elements with unique coloring

I've been working on creating a breadcrumb that resembles the design shown in this https://i.sstatic.net/lRcIN.png I have made some progress, but I'm struggling to add the border colors to the <li> items. Can anyone help me with this? Here ...

Styling your navigation with a CSS background

Having trouble creating a custom CSS navigation for my website. Below is the code snippet of my attempt at a vertical navigation: <style type="text/css"> /* Custom stylesheet */ #cssmenu > ul { list-style: none; margin: 0; padding: 0; vertical-a ...

Tips for consistently showing the addition symbol in my search bar

I created a code snippet that showcases a search box with CSS animations and jQuery toggling functionality. One issue I encountered is ensuring that the plus icon remains visible at all times, whether the search box is expanded or contracted. How can I ac ...

splitting up the lengthy list into manageable chunks according to the screen dimensions

How can I make the blue color row-based list (the divs inside a div with id phrase) break on the next line based on the screen size? Any suggestions on additional changes needed in the following CSS? #phrase { color: #fff; position: ...

Delay the fading in of an element using jQuery

Is there a way to remove the pause between the images in my JavaScript/jQuery slideshow when fading in and out? I attempted using a small delay, but it still didn't eliminate the blank space. Any suggestions? Check out the code on jsfiddle: https://j ...

Displaying a success dialog after closing a Bootstrap modal

I have set up a bootstrap modal containing a form. Upon submitting the form, the form content is hidden and a bootstrap alert message is displayed. However, upon clicking the bootstrap popup, the same alert message is shown in the popup instead of displayi ...

Creating double borders on a single element without using a wrapping div is possible using only CSS

I am attempting to create a specific effect using just one element, aiming to eliminate the need for a wrapper div. Check out my progress so far: http://codepen.io/anon/pen/kdvex Although I have come close to achieving the desired effect by incorporating ...

The JavaScript script that is supposed to change backgrounds is malfunctioning

Trying to develop a simple function that alters the background of a specific element when it is clicked by the user const customFunction = document.querySelectorAll("article .customClass"); const changeBackground = function() { const back ...

What is the best way to showcase various types of files such as images, documents, Excel sheets, and PDFs in the

Looking for help to display different file types like images, documents, Excel files, and PDFs in the preview-image box. Any assistance would be greatly appreciated! *{margin:0px; padding:0px;} #container{width:20%; padding:2%; box-shadow:0px 0px 10 ...

CSS - Update BackgroundColor Depending on Child Element Color

Is there an official CSS way to change the background color based on the child element in HEX? For example: render() { return ( ... <span> <h3 style={{ color: item.color }}>Item Color</h3> </span> ...

Is it possible for this solution to be compatible with IE7 and IE6?

Is there a way to enhance this solution for compatibility with IE6 and IE7? http://jsfiddle.net/kirkstrobeck/sDh7s/1/ Referenced from this discussion After some research, I have come up with a practical solution. I've converted it into a new func ...

Arranging buttons beside an image

I had previously inquired about a similar issue, but I've since made some style changes and now I'm unsure of how to position the close button in the top-right corner of the image, along with the previous and next buttons on either side of the im ...

Arranging Images with CSS Overlapping

I am striving to make the blue block and red block scale proportionally with the webpage, while also maintaining their position without any shifting up or down. As depicted in this gif, the blocks somewhat accomplish what I desire when scaling diagonally, ...