Solved

Lines Not Lining Up

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
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 an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

776 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