What is the trick to getting the logo to display on the upper left of the divided background without appearing beneath it?

* { 
    margin: 0; 
    padding: 0; 
    font-family: 'Montserrat', sans-serif; 
}

.wrapper { 
    width: 1170px; 
    margin: auto; 
}

.logo img { 
    width: 84px; 
    float: left; 
    padding-left: 5%; 
    padding-top: 2%; 
}

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>LoLstudy</title> <link rel="stylesheet" href="fstyle.css" /> </head> <body> <div class="container"> <div class="left"></div>

that's the code for a website layout I'm working on, what do you think of it?

Answer №1

To adjust the layout, simply modify the position: absolute property in the .appbar class to either position: fixed or delete the position property.

* {
  box-sizing: border-box;
}

.container {
  width: 100%;
  height: 100vh;
  display: flex;
  position: relative;
}

.appbar {
  width: 100%;
  height: 60px;
  display: flex;
  position: absolute;
  align-items: center;
  top: 0;
  z-index: 999;
  padding: 0 2rem;
}

.logo {
  font-size: 20px;
}

.fragment {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
}

.left {
  background-color: cadetblue;
}

.right {
  background-color: burlywood;
}
<div class="container">
  <header class="appbar">
    <a class="logo" href="#">LOGO</a>
  </header>

  <div class="fragment left">
    <h2>Left</h2>
  </div>

  <div class="fragment right">
    <h2>Right</h2>
  </div>
</div>

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

Transforming hover interactions into onclick events involves adjusting the CSS and JavaScript

Is there a way to convert this hover menu into an onclick menu? <div id='cssmenu'> <ul> <li class='has-sub'><a href='#'><span>Users</span></a> <ul> ...

Trouble with Bootstrap 5 Padding Distorting the Aspect Ratio of Image Collection

I am struggling to manage three images in a layout where they span one row and two columns (please refer to the image). While I can make it look perfect at one screen resolution, the ratio of the images becomes distorted when viewed in other screen sizes d ...

Tips for designing a hexagonal chessboard using CSS

I am looking for help with a web development project where I want to create a CSS and HTML version of the hexagonal chess board shown here. My objective is to reproduce the grid structure of the chessboard while excluding the text that accompanies it. Cur ...

What are some techniques for achieving smooth edges on CSS border shapes?

Could someone help me with this issue I'm facing in CSS? My screen shot shows blurred edges on the top-left side, and as a CSS beginner, I'm not sure how to fix it. Any solutions? https://i.sstatic.net/1mJUj.png .shape { position: absolute; ...

Whenever the cursor hovers over, the DIV above the iframe flickers

I'm having trouble placing a social button on top of an iframe that contains a YouTube or Vimeo video. The social buttons are located within a div container, which reveals or hides the content with JavaScript. However, I'm experiencing a blinking ...

Ways to structure a div to resemble a table

I'm currently working on a form that has multiple input fields, and I'm looking to structure them in a specific way. The layout I want to achieve can be seen in this example: https://jsfiddle.net/dmilos89/58ea82gj/2/ The example above utilizes ...

Center text inside a circle using CSS styling

Having trouble centering text inside a circular element with the code provided below. I've tried various methods but can't seem to get it aligned both vertically and horizontally. .circle { background: rgba(72, 156, 234, 1); background ...

Developing a placeholder directive with AngularJS

Are you looking to create a unique element in AngularJS to facilitate nested ng-repeats? Take a look at the example below: data.test = [{h:1, d:[11,12]}, {h:2, d:[21,22]}]; ---------------------- <custom ng-repeat="a in data.test"> <h3>{{a ...

What is the best way to create a website where images align perfectly with stacked cards?

Having trouble aligning the image on the right side of my website with two cards on the left side. Here is an example of what I'm aiming for: (https://i.sstatic.net/fBvTQ.jpg)](https://i.sstatic.net/fBvTQ.jpg) This is the current code: <!doctyp ...

What could be the reason for the unexpected behavior of position sticky?

I am encountering an issue while trying to figure out why the container__item--special element behaves as a sticky element in this code snippet <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8> ...

Is there a way to send multiple actions to Node.js via a dropdown list using POST method?

I have encountered an issue where I am trying to include multiple actions in a single form within a dropdown list. However, I am only able to POST one action at a time. admin.html <form action="/start" method="post" id="tableForm"> <select id= ...

The dynamic table is too large for the bootstrap card

My issue involves datatables within bootstrap cards. When the table exceeds the height of the card, it extends outside the boundaries. Even with overflow: auto on a table-wrapper in place, the scroll does not trigger when exceeding the card's height. ...

Preventing the elements within a div section from shifting position

I am facing an issue with a div section that contains multiple <a href=""> tags. When I shrink the div section on the page, the contents move when a user tabs into it. Is there a way to lock the div section so that its contents do not move? For exam ...

Using jQuery to show text upon hover using a `for` loop

I'm currently working on a webpage and incorporating a feature where hovering over specific div elements triggers the display of certain text in another div. There are 5 elements that I want to make hoverable and show text upon interaction. After imp ...

The script has been modified to add "=s1400" to the image source path, causing the image to fail to load

I have a good understanding of HTML and CSS, but I'm struggling with JavaScript. I noticed that there is a script adding "=s1400" to the image path which is causing the image not to load. You can see the URL is (source files can be viewed using Chrom ...

JavaScript: Understanding the concept of closure variables

I am currently working on an HTML/JavaScript program that involves running two counters. The issue I am facing is with the reset counter functionality. The 'initCounter' method initializes two counters with a given initial value. Pressing the &a ...

management of vertical navigation bar on adaptable screens

My vertical navigation bar collapses when the screen size is less than 1000px, but I want it to remain the same size as my page. When I click the collapse button, I want the vertical menu bar to appear as it does on a big screen, instead of as a dropdown. ...

Transform your current website layout from a fixed 960-grid system with 12 columns into a fluid and

As a newcomer to web development, I have successfully created my portfolio website. I initially set the body width to 1600px because that matched the size of my banner background in Photoshop. I'm using a 960gs 12-column grid system, but when I view t ...

Split the page in half with a background image on one side and text on the other

Is there a way to split the page vertically, with a background image on one side and text on the other? I've been struggling to achieve this layout - the background image won't stay on the left while the text remains on the right. Can someone off ...

Email Template Concern

I have been encountering an issue with my Windows Application as it sends email using Email template images. However, when sent to a different SMTP server, the result is not consistent - it attaches the template images as attachments. Currently, I am util ...