Solved

Lines Not Lining Up

Posted on 2016-09-24
2
99 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Find out what you should include to make the best professional email signature for your organization.
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 learn how to count occurrences of each item in an array.

752 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