Side-Align Your List in HTML

Presenting this image:

https://i.sstatic.net/VNF7J.png

However, I desire it to be like this:

https://i.sstatic.net/ItgEN.png

Don't mind the white space, it's just decoration.

.server_name {
  font-size: 50;
  padding-left: 5;
  z-index: -1;
  display: inline-block;
  padding-top: 0.001%;
}

.right_buttons {
  z-index: 1;
  list-style: none;
  float: right;
  vertical-align: top;
  display: inline-block;
}

.option_button {
  padding-bottom: 20;
  font-size: 30;
  text-align: center;
  text-decoration: unset;
  list-style: none;
  font-weight: bold;
}

.option_text {
  text-decoration: none;
  text-align: center;
}

.server_options_button {
  background-color: #555555;
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
}

.server_options {
  float: left;
  padding-top: 500;
  list-style: none;
  display: inline-block;
}
<h1 class="server_name">Server_name</h1>
<ul class="right_buttons">
  <li class="option_button"><a href="#" class="option_text">Change Server</a></li>
  <li class="option_button"><a href="#" class="option_text">Log Out</a></li>
</ul>

<ul class="server_options">
  <li class="server_options_button_ph"><button class="server_options_button">Moderation</button></li>
  <li class="server_options_button_ph"><button class="server_options_button">Music</button></li>
  <li class="server_options_button_ph"><button class="server_options_button">Minecraft</button></li>
</ul>

Answer №1

Consider using margin-top: 10%; instead of padding-top:500 in your CSS for the class .server_options.

.server_name {
  font-size: 50;
  padding-left: 5;
  z-index: -1;
  display: inline-block;
  padding-top: 0.001%;
}

.right_buttons {
  z-index: 1;
  list-style: none;
  float: right;
  vertical-align: top;
  display: inline-block;
}

.option_button {
  padding-bottom: 20;
  font-size: 30;
  text-align: center;
  text-decoration: unset;
  list-style: none;
  font-weight: bold;
}

.option_text {
  text-decoration: none;
  text-align: center;
}

.server_options_button {
  background-color: #555555;
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
}

.server_options {
  float: left;
  margin-top: 10%;
  list-style: none;
  display: inline-block;
}
  <h1 class="server_name">Server Name</h1>
  <ul class="right_buttons">
    <li class="option_button"><a href="#" class="option_text">Change Server</a></li>
    <li class="option_button"><a href="#" class="option_text">Log Out</a></li>
  </ul>

  <ul class="server_options">
    <li class="server_options_button_ph"><button class="server_options_button">Moderation</button></li>
    <li class="server_options_button_ph"><button class="server_options_button">Music</button></li>
    <li class="server_options_button_ph"><button class="server_options_button">Minecraft</button></li>
  </ul>

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

What is the best approach to ensure consistent spacing between columns of the same height in Bootstrap?

I'm currently working on a website project that involves displaying images in a specific grid format. To achieve this, I am utilizing Laravel and Bootstrap. The primary objective is to create a grid layout with spacing that maintains the height of th ...

The icon displays correctly in Firefox but is not visible in IE

link REL="SHORTCUT ICON" HREF="/images/greenTheme/favicon.ico" type="image/x-icon" While this code functions properly in Firefox, it appears to be causing issues in Internet Explorer. Can anyone provide guidance on how to resolve the compatibility issue w ...

learn the technique I use to incorporate a see-through background in HTML

Is there a way to enclose a specific section of text with a background to improve readability, considering that changing the text color is not the preferred solution due to an existing background image? ...

Tips for properly aligning an image within an HTML iframe

I've been working on positioning an image inside an iframe, but so far my research hasn't yielded the results I need. Here's what my code looks like: The HTML <div class="modal-body description"> <div class="modal ...

Activate Dropdown on hover and automatically close the menu when a link is clicked

Looking for assistance with a Dropdown menu that opens on mouse hover but needs to close when a link is clicked within the menu. Do you think JavaScript would be necessary for this function? .dropdow { position: relative; ...

When I calculate the sum of 4.5 and .525 in HTML, the result is 5.025

When I perform an addition operation in JavaScript, instead of getting the expected result of 4.5 + .525 = 5.025, I receive 4.5.525. Here is the code snippet: <!DOCTYPE html> <html lang="en"> ... <button class= "b ...

Vanishing message when clicked in PHP

I created a code to display error messages and success messages based on user input, allowing them to click anywhere on the screen to dismiss the message. The issue I am facing is that when the user receives both a success and an error message simultaneo ...

How can I make <p> elements change color when scrolling?

My Goal https://i.sstatic.net/JbdXR.gif I aim to bring attention to the <p> element as the user scrolls on the page. Initially, the opacity is set to 0.3, but I want it to change to 1 gradually as the user scrolls down. My Attempt window.o ...

Unable to render nested HTML tag in simple React.JS component

I'm currently working on setting up my first component. After following a tutorial, I tried implementing their code to create the component. The code does inject the first <div> into the HTML document, but the <h1> element is missing. In ...

When the HTML code is rendered in a web browser, the CSS styles are not being

I am utilizing adminer within a docker container. When testing services, I utilize the URL mydomain.tld. In order to interact with this container directly, one option is to expose and map a port, such as mapping port 8081 to the adminer port 8080. Access ...

Stripping away HTML tags from a JSON output

I'm attempting to retrieve a JSON result using jQuery. $.ajax({ type: "GET", url: "http://localhost:8080/App/QueryString.jsp?Query="+query, contentType:"text/html; charset=utf-8", dataType: "json", success: function(json) { if(data!="") ...

How to style date strings in JavaScript, jQuery, or CSS

Below are dates that need formatting: 7-sep, 14-sep, 21-sep, 28-sep, 5-oct,12-oct, 19-oct,26-oct, 2-nov, 9-nov, 16-nov, 23-nov,30-nov, 7-dec,14-dec, 21-dec,28-dec-2013. Is there a way to tidy them up using JavaScript, jQuery, or CSS? Ideally, I would lik ...

The image sequence animation only loads once and does not continue indefinitely

Here is my code snippet: I have a sequence of 15 images that should load one after the other in a loop with a specific time interval. However, I am facing a bug where the images keep playing infinitely when the page loads, but I want them to play only once ...

Exploring design techniques in React Native

I am currently part of a team working on a react native project with multiple contributors. My goal is to find an effective way to segregate the styling tasks from coding, allowing UI developers to work independently without relying on code developers. In ...

I need to show a DIV element when a specific anchor is in an active state within an HTML document

Is there a way to make the code below only visible when the url ends with #404? <!--404 code--> <style> .div1 { width: 300px; height: 100px; border: 1px solid blue; border-color: #ff0263; box-sizing: border-box; } < ...

CSS: concealing certain portions of an element's content

I don't have control over the following markup: <p class="filename"> <img src="http://domain.com/uploads/image_gallery/_thumbs/Chrysanthemum.jpg" alt="Chrysanthemum.jpg"> <br> Chrysanthemum.jpg </p> Is it possible ...

Issues with displaying images in CSS when using HTML 5 canvas drawing

In attempting to draw an image on a canvas using a pre-loaded image and CSS, such as: img.style.backgroundColor="red"; ctx.drawImage(img,0,0,100,100); I have observed that the image is drawn without incorporating the CSS modifications. Are HTML canvases ...

Webpack will only load images that are referenced within CSS files, and it will not load images that are referenced within

Within my dist folder, you will find index.html, contact.html, index.js, contact.js, and two images referenced by my css as background images. For example: background-image: url("../images/prairie.jpg"); These are the only items in my dist folder. Any o ...

CSS Malfunction in Chrome: Some Code Not Displaying Properly

Below is the content of my main.css file: body { font-family: josefin; } .splash-content { text-align: center; } .register-button { color: #6A136C; width: 300px; height: 100px; border: 5px solid #6A136C; } .btn { padding: 1 ...

Utilizing fanybox-2 for creating a variety of background colors

I am currently using fancybox to showcase some of my website links with opaque backgrounds as requested by the designer. I have successfully customized the background color to meet the requirements. However, I am now facing a new question: is it possible ...