Steadfastly positioned at the top of the page, a Div is proudly displayed showcasing a logo on the right while presenting

I'm facing an issue with my fixed div. I'd like to align my logo to the right, so it appears centered, and have my navigation links on the left. However, when I resize my browser window, the links overlap the logo, and vice versa.

Is there a way to keep the position of my logo and links consistent when resizing? Can they move together as I adjust the window size?

Check out the code here

<div id="container">
<div id="nav"> <div>
  <spanl> 
         <a href="index.html"> LOGO IMAGE </a>
  </spanl>
  </div> 

<div>
<spantr>
    <ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Merchandise</a></li>
<li><a href="#">Gallery</a></li>
</ul>
</spantr>
</div>

#nav {
position:fixed;
left:0px;
top:0px;
height:55px;
width:100%;
background:#999;
}

#container div spanl{
position:absolute;
top:0px;
left:500px;;
padding: 1em;

 }
 #container div spanr{
position:absolute;
top:0px;
right:500px;
padding: 1em;
margin-left: auto;
margin-right: auto;

 }

ul {
overflow: visible;
list-style-type: none;

}

li {
height: 15px;
float: left;
margin-right: 0px;
margin-top: -10px;
border-right: 1px solid #aaa;
padding: 0 10px;

}

li:last-child {
   border-right: none;
}

Answer №1

What do you think of this setup? I applied the float property to align the navigation to the left and the logo to the right.

Check it out here!

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

Is there a way to adjust the theme color in _variables.scss by recompiling Bootstrap while working with Angular and CSS?

I've been trying to update the primary color in my Angular project by editing the SCSS file node_modules/bootstrap/scss/_variables.scss. However, after stopping npm and running the front-end again, I noticed that the changes I made are not reflected i ...

Sending user input from a Laravel modal form to a controller as a parameter

I have a button that triggers a modal form where the user can update their group name. I'm trying to pass the ID into the form using {!! Form::open(['action' => [ 'ContactsController@update', id]]) !!}. I attempted to do this si ...

Troubleshooting layout problems caused by positioning items at window height with CSS and jQuery

At this moment, my approach involves utilizing jQuery to position specific elements in relation to the window's size. While this method is effective when the window is at its full size, it encounters issues when dealing with a debugger that's ope ...

What is the best way to center align all elements using a wrapper in CSS grid?

I am working on designing a layout that looks like this: https://i.sstatic.net/jAaXL.jpg I have set the wrapper as a class and aim to center everything on the screen. Aside from the wrapper, I also want to make the text and form equal sizes. Here is th ...

JQuery is capable of hiding a div using the .hide() method but is unable to reveal it using the

I am currently working on a basic webpage that includes a question and a set of radio buttons. Depending on the option selected by the user, the question will be hidden and either a correct or incorrect message will be displayed, both of which are initiall ...

What is the best way to personalize the icon for this navigation button?

I'm interested in making some changes, especially to the border. I've already figured out how to adjust the color of the 3 bars like so: .navbar-default .navbar-toggle .icon-bar { background-color: #fff; } Modification RESOLUTION .navbar- ...

The browser is not displaying the HTML correctly for the Polymer Paper-Menu component

I attempted to implement a paper-menu, but I am facing issues with the rendered HTML and its interaction. When I click on a menu item, the entire list disappears due to the paper-item elements not being properly placed inside a key div within the paper-men ...

Show the identical Javascript code in Bootstrap columns with a size of col-sm6

I have a javascript code with a function called fuctionone() that generates a graph. I include this code within a p tag so that when 'HERE' is clicked, the graph is displayed below each section header. <svg width="480" height="250"> <di ...

What is the best way to eliminate an iframe from inside itself using javascript?

Although I am aware of similar questions being asked before, I find myself having to raise this question again along with some attached code because I am struggling to figure it out. In my JSF project, I have two .xhtml files. The first one is mainPage.xht ...

Ways to avoid single-sided border from overlapping with border radius

When adding a 2px bottom border to a text field with a 4px corner radius on the container, the border tends to curl around the edge due to the larger radius. I am looking for a solution to keep the bottom edge flat. [What I DON'T want: border wrappin ...

What is the best way to align a div in the middle of an input-group div?

When dealing with a nested div, where the parent div is styled with an input-group class, my goal is to have the nested div centered within the available line or on the next free line space. This is the desired layout I want to achieve regardless of the n ...

Adjusting the alignment of button text in an Angular Kendo grid

I am currently utilizing the grid view feature of Kendo UI for Angular. While I have buttons on the grid, the issue is that the text within the buttons is not centered properly despite applying styles such as text-align:center. Here is the template for my ...

Navigate back to the previous page upon form submission to a PHP file, with a div dynamically populated with targeted content

I'm facing a logic dilemma: I have a webpage with a div called #content, where I've embedded another page containing a form for submitting data* (there are other pages loaded into #content as well, but they are not active at the same time, one o ...

The parent container is not properly wrapping its content in Internet Explorer only

Check out this code snippet I have here: https://jsfiddle.net/kimwild/mtxgtwr5/2/ main#wrapper { z-index: 1; width: 100%; position: relative; overflow: hidden; background-color: red !important; border: 10px dotted #4D37DB; } figure#about-im ...

Creating a Rectangular Trapezoid Shape with CSS - Eliminating Unnecessary Spacing

I'm trying to create a trapezoid button using CSS. Here is the intended look: https://i.sstatic.net/0vqlk.png However, my current implementation looks like this: https://i.sstatic.net/QrR4t.png The button appears fine but there seems to be some e ...

Phonegap application functioning smoothly on computer, encountering issues on mobile device

Hey there! I recently developed a phonegap app that retrieves JSON data from a YQL link and presents it to the user. It works perfectly on Google Chrome desktop, but my client mentioned that it doesn't work on his Android 2.3 device. Could you help me ...

Enhancing the appearance of each letter within a word

I am currently working on styling the word "Siteripe". Each letter should have a different color, just like it is shown on this website. I have successfully styled only the first letter using the following CSS code: #namer:first-letter { color:#09C; f ...

the solution to resolving misaligned CSS divs

I am facing an issue with displaying 3 div cards that contain different sets of information. Despite setting them to display:grid and trying to evenly distribute the fractions, the divs are stacking awkwardly. JS fiddle demo <!--Main Background-- ...

Program for Saving Facebook Photo Collection

Currently, I am delving into the world of JavaScript through a project aimed at creating a Facebook album downloader. My goal is to design a tool that can automatically download all images from a specific album on Facebook – for instance, this one: . Af ...

Converting the length attribute of a table to a string does not yield any

After grappling with this bug for some time now, I've come up empty-handed in my search for a solution online. Expected Outcome: Upon pressing the create row button, I anticipate a new row being added at the bottom of the table. This row should cons ...