View Single Post
EightBitz
Senior Member
 
Join Date: May 2013
Posts: 1,458

Old January 27th, 2017, 02:22 AM
Quote:
Originally Posted by Parody View Post
One thing that might help is specifying a DOCTYPE. The sample outputs I've seen don't have one, leaving the browsers to make more guesses about how to display your HTML+CSS. (It's called "rendering in Quirks Mode" if you want more info.)

The DOCTYPE needs to be the first line of your HTML file. The one for HTML 5 is pretty simple:
Code:
<!DOCTYPE html>
Adding that won't make the different browsers (and versions of browsers) create identical output, but they should end up a lot closer than before.


The style attribute does override earlier styling, but only for the things specified within. Anything not included in the style attribute will be determined by whatever other rules exist. The rules in your external CSS file will only have no effect if the style attribute overrides everything within those rules.


Looking at the part of tmilktoast's sample where there's a list, the surrounding <p> elements' style attributes have a margin-left but the <ul> does not. HTML lists should be treated the same as paragraphs and tables for most styling purposes.

FWIW, I think you'd be better off putting a <div> around the things you want to indent and adding padding or margin to the <div>. (I threw a quick example up at JSBin.)
The thing that confuses me is that in my own testing, there IS a margin-left in the UL tag. My lists, ordered and unordered, are properly indented along their respective topics and sections.

One thing I noticed though, is that my UL tags have two style declarations.

Code:
<ul style="margin-left:105px;" start="1" style="margin-top:0;margin-bottom:0;">
I fixed this in other parts of the code to incorporate everything into one style declaration. I missed doing that for lists.

I'm wondering if maybe in the process of uploading his html file, something in that process detected the two style statements, determined that as invalid, and deleted one of them?

Or maybe he manually edited something? I have no idea. I don't understand why I would have the margin-left statements in my output, and he wouldn't.
EightBitz is offline   #75 Reply With Quote