What is the best way to implement this header style with code?

I came across this design from a potential client recently, even though we didn't end up working together. I thought it would be a good exercise to try coding the design for practice purposes. Just to clarify, this is not my original design and I have no intentions of using it for anything other than practice. That's why I've edited out the name of the company in the design.

However, I'm facing some challenges with the header/navigation area of this design. The side decorations next to the logo and the fact that the logo spans two divs are making it difficult for me to figure out how to code it. I'm seeking advice on how others would approach coding something like this.

My initial thoughts were to have separate divs for each side decoration and maybe use absolute positioning for the logo. Does this sound like the right solution?

At first, I tried incorporating it into the 960 grid system, but the issue of the logo spanning two divs made it really tricky to work within the grid structure.

Answer №1

To optimize your code, consider using a single list and applying a class to the third item to adjust the margin-right for spacing out a h1 logo. This approach maintains semantic markup without requiring multiple nested div's or lists.

An alternative method is utilizing the nth-child CSS selector instead of adding a specific class.

Answer №2

Perhaps you could consider using a font-face for the font if the client has purchased it, as that would simplify things for you.

In addition, I suggest removing the dots between the links and text, utilizing an image for the background, and creating a single UL with each li assigned a class corresponding to the page, such as home, about, galleries. You can then use PHP to add the current_page class dynamically.

Following the galleries section, include another li element with the following markup:

<li class="logo"><a href="/">Logo</a></li>

Add styles like this.

li.logo {
    background: transparent url(....) no-repeat;
    width: width of logo;
    height: height of logo;
    display: block;
    overflow: hidden;
}

li.logo a {
    text-indent: -9999px;
    width: 100%;
    height: 100%;
    display: block;
    overflow: hidden;
}

If you need assistance implementing this or want to see examples, feel free to reach out to me.

Answer №3

To create a more visually appealing layout, consider splitting the design into two separate rows. The first row can feature the "design" elements flanking the logo image at the center. This arrangement allows you to emphasize the logo without overshadowing the designs. For the second row, divide it into sections for navigation elements and the logo placement. It's advisable to enclose everything within a div container with specified dimensions matching the images' sizes. Keep the structure simple yet functional. While individual divs are an option, they may not be necessary in this case. For a cost-effective solution, stick with the current image and apply an image map to incorporate necessary links. Although this method might exclude features like rollover images, it aligns with a budget-friendly approach. As a learning opportunity, experiment with different coding approaches. Try floating elements, absolute positioning, creating columns and rows, overlaying navigation on a large background image, and exploring other creative methods—just avoid using tables! :)

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

Strange HTML antics

On my website, I encountered an issue when trying to register without entering any information into the required fields. The errors were correctly displayed in this screenshot: However, after inserting random characters into each field and attempting to r ...

Retrieve identification details from a button within an ion-item located in an ion-list

<ion-list> <ion-item-group *ngFor="let group of groupedContacts"> <ion-item-divider color="light">{{group.letter}}</ion-item-divider> <ion-item *ngFor="let contact of group.contacts" class="contactlist" style="cl ...

Creating a jquery DataTable from HTML generated by angular $sce can be done by following these steps

I have created an Angular controller that takes data and generates an HTML table from it. The generated table is being displayed on the page. Now, I want to apply jQuery data tables using that scope variable. The variable contains the HTML code of the tabl ...

Skipping every third index in a JQuery .each loop after removing an element

I have a project where I need to display elements in rows of 4, and when an element is deleted, I want the remaining elements to shift up. To achieve this, I am currently assigning a class "last" to every fourth item after a deletion and inserting a spacer ...

magnificPopup experiencing difficulties when attempting to invoke a class that is dynamically generated within the HTML document

Currently, I am encountering an issue with the magnificPopup. Whenever I try to trigger the popup using the class 'popup-with-zoom-anim', it doesn't seem to work as expected. Has anyone else faced a similar problem before? <body> < ...

What is the best way to line up several elements in a single column?

I am facing a layout challenge with two objects inside a column - a paragraph and an image. I need the image to be positioned at the bottom and the paragraph at the top. I have tried using various Bootstrap classes like "align-items-between" and "align-sel ...

What is the best way to hide the button when a user is viewing their own profile in an Angular application?

Each user has their own profile on the platform. A unique feature allows users to send messages by clicking a button when viewing other profiles. However, an issue arises where this messaging button also appears on a user's own profile. Is there a way ...

Is there a workaround using jQuery to enable CSS3 functionality across all browsers?

Is there a way in jQuery to make all browsers act as if they have CSS3 capabilities? ...

Struggles encountered while developing a JavaScript calendar

Hey guys, I'm encountering an issue with Uncaught TypeError: document.getElementById(...) is null. I believe the problem lies in the way types are being parsed for document.getElementById(dayOfWeek).appendChild(dayPTag);. This code is meant to display ...

Reinitializing AngularJS form controls

Check out this codepen example: http://codepen.io/anon/pen/EjKqbW I'm trying to reset the form elements when the user clicks on "Reset". The div elements f1,f2,f3 should be hidden and the searchText box cleared. However, the reset button is not trig ...

When utilizing dynamic binding within *ngfor in Angular 4, the image fails to display properly

I'm encountering an issue with an <img> tag that isn't behaving as expected in my code snippet: <div *ngFor="let familyPerson of userDataModel.family" class="col-md-6 col-lg-4 family-member"> <div class="fm-wrapper"> ...

The li elements in a horizontal menu all have equal spacing between them, filling the width of the ul

I designed a horizontal menu navigation system using HTML elements ul for the main menu container and li for menu list items. The layout is structured with display table for ul and table-cell for li. However, I encountered an issue where there are inconsis ...

Guide to positioning an image at the center across 2 columns using Bootstrap

Looking to create a split screen Bootstrap 4 layout with an image in the center overlapping the two columns. Have successfully set up two equal columns but struggling to position the image to overlap. Have experimented with position:absolute and float:lef ...

What could be causing the error.status value to not be displayed on my Embedded Javascript (EJS) page?

Currently utilizing ejs, node.js & express along with other packages I'm facing an issue where the error.status and error.stack values are not appearing on the rendered page. I suspect that the error variable may be undefined or inaccessible within t ...

Tips for invoking a url with JavaScript and retrieving the response back to JavaScript

I am trying to make a URL call from JavaScript with a single parameter, and the URL should respond to that specific request. Here is an example of the response format: {"success":true, "result": {"token":"4fc5ef2bd77a3","serverTime":1338371883,"expireT ...

I am in need of setting up two rows side by side using the display

I'm trying to have two rows side by side using display grid, but I'm facing some issues. When I use the following CSS... .grid-container { display: grid; grid-template-rows: auto auto; grid-template-columns: auto; grid-column-gap: 100px;} It cre ...

The specified 'image' identifier has not been defined. There is no such member within 'never'

Edit :: Finally, I managed to get the output successfully, but there's still an error that baffles me. https://i.stack.imgur.com/2wrNM.pngAlthough I've tackled similar issues in the past, this particular one seems elusive. I attempted using "?", ...

What is the reason behind individuals choosing to minify assets instead of minifying the HTML

Have you ever wondered why people emphasize the minification of web assets like CSS and JavaScript, yet rarely mention doing the same for markup? It's interesting to note that CSS and JavaScript are often reused across multiple pages, whereas markup i ...

The animation isn't loading

I discovered a handy script that displays a waiting message when my form is submitted. I implemented jquery-ui to showcase this message in a dialog box, and it was successful. However, upon customizing the text and adding an animated gif background using C ...

The correct functioning of CSS hyperlinks is currently experiencing issues

The links in the "request" division are not displaying properly. The style.css file contains the following code for the links in this division: .header .request a span{border-bottom:1px dotted}.header .request a:hover span{border-bottom:0} Example: berdy ...