What steps can I take to improve the alignment of my portfolio website?

I recently started learning HTML and CSS and am currently working on creating my very first portfolio website.

While I've made some progress, I'm facing a few challenges and could use some guidance. My main goal is to have a fixed navigation bar that stays in place as users scroll down the page. However, I'm struggling with aligning different elements properly on the body of the site. Specifically, I can't seem to get the image, table, and objective section to align the way I envision them.

Here's what I want to achieve:

  • The image should be positioned to the far left of the page, centered vertically, and below the navigation bar
  • The table needs to align directly below the image (meaning wherever the image is located)
  • The objective section should be to the right of the page, next to the image but with ample spacing between them
  • The title should sit above the objective (aligned with the objective)
  • In summary, the objective and title should be on the right side of the page, while the image and table should be on the left

Current Issues:

  • Title overlaps with the navigation bar
  • Alignment issues with table, image, and objective

Any assistance or advice on how to tackle these challenges would be highly appreciated. Thank you!


HTML Section:

<!DOCTYPE html> 
<html> 
<head> 
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
<title>FULL NAME</title>
</head> 

<body> 

<div id="center">
<h1>NAME</h1>
<img src="#"/a>
<table>
<tr>
<td><a href="#"><img src="#"/></a></td>
<td><a href="#"><img src="#"/></a></td>
<td><a href="#"><img src="#"/></a></td>
<td><a href="#"><img src="#"/></a></td>
<td><a href="#"><img src="#"/></a></td>
</tr>
</table>

<h4>Objective<h4>

</div>

<div id="navigation"> 
<ul>
<li><a href="#">MENU ITEM</a></li>
<li><a href="#">MENU ITEM</a></li>
<li><a href="#">MENU ITEM</a></li>
<li><a href="#">MENU ITEM</a></li>
<li><a href="#">MENU ITEM</a></li>
</ul>
</div>


<div id="footer">
<div id="bottom">
<p> &copy; All Rights Reserved by FULL NAME<span class="em"></span></p></div>
</div>
</body>     
</html> 

CSS Section:

body {
    padding: 0;
    margin: 0;
    max-width: 960px;
    font-family: Verdana, Geneva, Sans-serif;
}

#navigation {
    position: fixed;
    top: 0; 
    color: #FFFFFF;
    height: 50px;
    text-align: center;
    width: 100%; 
    margin: 0;
}

#navigation  li {
    font-size: 30px;
    padding-left: -20px;
    padding-right: -20px;
    color: white;
    text-decoration: none;
    font-family: Georgia, Serif, Times;
    display: inline;
    float: left;
}

#navigation ul {
    width: 100%;
    list-style-type: none;
    margin: 0;
    padding: 0;
}

#navigation ul li {
    width: 20%;
    float: left;
    color: #00131C;
}

#navigation a:link, a:visited {
    color:#FFFFFF; 
    background-color:#000000; 
    text-align:center; 
    padding:6px; 
    text-decoration:none; 
    display: block;
} 

#navigation a:hover, a:active {
    background-color:#FFFFFF; 
    color: #000000;
}

...

Answer №1

Your code has a couple of mistakes that need to be addressed:

  • You have used <div id="center"> in your HTML, but your CSS references the class center
  • Using float: center; and position: center; is not valid CSS for centering objects. For guidance on how to properly center objects, check out http://www.w3.org/Style/Examples/007/center.en.html

To achieve the desired result, you may want to try something like this example: http://jsfiddle.net/vAuFA/

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

Transform the features of a website into a sleek iOS application using Swift

Can I take an HTML website coded with JavaScript and integrate its functionality into my app using WebKit or another method? By using WebKit or WebViews, I can load an entire webpage into my app, automatically bringing along its functionality. However, i ...

Utilizing CSS to Properly Position HTML Elements

Check out my code on jsFiddle I'm facing some challenges in positioning HTML elements using CSS. While I grasp the fundamental concepts of block and inline elements, implementing them in real coding scenarios can be confusing. I've shared my HTM ...

How can I style the inner HTML text of an element without altering the style of its subelements? (CSS Selector)

I created an html structure that looks like this: <p> This is some test inside the p tag <div class="some-class"> <div class="sub-div-class"> <i title="title test" data-toggle="tooltip" class="some-icon-class" data-ori ...

Setting Image Height with CSS

I have a div with a height of 105px. The image inside the div is 359px tall. How can I adjust the div's size to prevent cutting off the image and ensure it displays in full height? Thank you for your help! ...

What is the reason that this particular JQuery code is malfunctioning in the IE browser once integrated into my website?

Currently, I am utilizing the DDCharts jQuery plugin from DDCharts JQuery to incorporate some charts into my website. After downloading the plugin and testing it in various browsers, I encountered an issue specifically with Internet Explorer 8+. Strangely, ...

Tips for making a CSS sprite clickable using the <a> tag instead of relying on Javascript

Can you create a click-able CSS sprite without the use of Javascript? Here's an example: Check out the live demo here. HTML: <div></div> CSS: div { width: 100px; height: 100px; background-image: url(http://perfectwebtutori ...

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 ...

Sending a form using an AngularJS dropdown menu

I have recently started using angularjs and decided to switch out a traditional html <select> box for an angular modal select box. The select box successfully populates with data from a $http ajax request, but I am facing issues with form submission ...

Tips for removing a row from a table

I've been working on a responsive data table where each time I click an add button at the end of a row, a new row is added with the add button turning into a delete button. Below is the code I've implemented: The Table: <table id="invoice_ta ...

The href attributes are not being retrieving correctly

I'm currently working on extracting the URLs for each restaurant listed on this page and have developed a Python script for this purpose: import time from selenium import webdriver from selenium.webdriver.common.keys import Keys browser = webdriver ...

How to set DIVS to be hidden when the page first loads

I am currently working on a project where I need to use JavaScript to hide certain <div> elements when the page loads. I have also included jQuery in my code. Below is what I have tried so far: $(document).ready(function() { hide(); function hid ...

Looking to display the view source of an HTML page, but it keeps redirecting to another site when I try. Anyone know how to diagnose and fix this issue?

Can anyone assist me in displaying the HTML source of a page without it redirecting to another site? Here is the URL: ...

Hiding scrollbars in a component: The ultimate guide

I am seeking a way to completely hide scrollbars from an HTML component using CSS styles within a VueJS component. I have tried the solution of using overflow-y: hidden; within the component as well as within a specific subclass in the CSS, but neither com ...

Display radio options when clicked upon

I am in the process of creating a set of radio buttons that will be utilized for capturing values to generate a subscription/modal checkout. My current situation involves having the radio button options visible. However, I aim to achieve a functionality wh ...

A guide to retrieving all image URLs when a checkbox is selected using Javascript

My goal is to extract only image URLs from the concatenated values of price and picture URL. However, when I check different images using checkboxes, it always displays the URL of the first selected image. When I try to split the value, all the prices and ...

Rendering JSON data in a dropdown menu

When I select an option, all the data is being combined into one row. I want the data to fill each row based on the select option. Any suggestions on what code I should modify or add? Is it related to the loop or should I create a dynamic id for the selec ...

What is the best way to trigger a tooltip when an input field is clicked?

I want to implement a form that displays tooltips whenever a user clicks or focuses on an input field, and the tooltip should disappear when the user clicks elsewhere. While I understand the basics of using JavaScript's getElementById and click event ...

Facing continuous 404 errors while working with nodejs and express

While attempting to collect data from a local host webpage's registration form that captures user information, I encounter an issue upon pressing the submit button A 404 Error is displayed stating "page not found", preventing the collection and out ...

Tips for vertically aligning input field text and checkboxes

I need help aligning a checkbox vertically in the middle of an input field and checkbox that are in the same row. Here is the current code snippet: <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" in ...

Tips on creating vertical stacked content utilizing CSS

Has anyone come across this game before? https://i.sstatic.net/hFX9o.png I am trying to stack each card in a column, here is my fiddle jsfiddle. In my scenario, I have cards wrapped in div elements with a maximum height. If a card exceeds this height, i ...