Solved

Lines Not Lining Up

Posted on 2016-09-24
2
118 Views
Last Modified: 2016-09-25
I have a page where the lines across the top do not line up. When I take out the doctype declaration and <html> tag it lines up. Can someone point me in the right direction?

http://domgarofalo.com/logan/
0
Comment
Question by:dgarofalo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
Kim Walker earned 500 total points
ID: 41814273
The issue is that img elements are inline elements just as text content is inline. The default value for the vertical-align property of all img elements is baseline. This means that the img sits above the baseline of the text around it. Whether there is text before or after the image or not, there is descender space below the baseline.

There are two methods of eliminating the descender space below the image. One is to change the vertical-align property to a value of top or bottom. This would cause the image to be aligned to either the top of the text ascenders or the bottom of the text descenders; effectively moving the text baseline up and eliminating the extra space.
img { vertical-align: bottom; }

Open in new window

The second method is to change the image display property to block. Of course, this would only work if the image was placed independently, without any text before or after it.
#header a img { display: block; }

Open in new window

It is interesting that removing the doctype makes a difference. I suppose the default vertical-align property for img elements is different in different versions of HTML.

Allow me to commend you for writing HTML compliant code. The HTML validator returned no errors when evaluating your page.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41814337
The background image has a fixed position for the lines but your header doesn't have a fixed height to match the position of the lines.  It also looks like the default margins and padding of the header elements is pushing the navigation section down.
0

Featured Post

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question