-16

I have a question about my Stack Overflow post: Why are margins not working in my HTML file and how can I fix that?

I have a problem with my HTML file, but I can't figure out how I should ask about it. The HTML file is available at https://pastebin.com/xCA10Ah4. The main problem is that I can't figure out what parts of the HTML are important, and if I paste the entire HTML as it is there, Stack Exchange doesn't allow me to ask it because it's mostly code. What is the best way to fix that?

3
  • 8
    You did yourself a great favor by posting that "placeholder" first. I honestly don't know why you thought it would be useful to post that instead of doing so after you got the information from meta. Also, "mostly code" isn't an issue with too much code, it is an issue with too less text/explanations. Adding more explanations wasn't an option?
    – Tom
    Commented Mar 9, 2023 at 17:41
  • 4
    "I can't figure out what parts of the HTML are important" What result did you arrive at by following the advice on the mre help page? What’s stopping you from following it further? Commented Mar 9, 2023 at 18:41
  • 2
    @Tom "I honestly don't know why you thought it would be useful to post that instead of doing so after you got the information from meta." Because participating in Meta requires 5 rep, and they don't have it. However, the system permits you to ask about your question on the main site at any rep level.
    – Ryan M Mod
    Commented Mar 9, 2023 at 21:02

2 Answers 2

7

You should create a minimal, reproducible example, and then post that as a question.

If you're seeing an error about your post being "mostly code", then there are three possible problems:

  1. You failed to format your code properly as code, instead including it as plain text. This is not readable, so don't do this. Format code blocks as code blocks by either indenting each line with 4 spaces or putting the whole thing in a fence created with three backticks (```).

  2. You do not have a high enough ratio of explanation to code. Posting a block of code does not a question make. It doesn't help to add some trivial text like "Here's my code" or "Why isn't it working?" We need a complete problem description: what does your code do? How are you running/trying it? What isn't working? What is the intended output? What is the actual output you see instead? Etc. Give us details and context.

  3. You have failed to create a minimal reproducible example, so you're trying to post hundreds or thousands of lines of code. That's way too much for a single question. Simplify that code by removing irrelevant parts. Then, you'll have less code, and it'll be easier to achieve a reasonable explanation-to-code ratio.

Do not post "placeholder" questions; these are an abuse of the system and will tend to result in penalties being applied to your account.

5
  • "Posting a block of code does not a question make." doesn't really make sense grammatically... => "Posting a block of code does not make a question."...?
    – chivracq
    Commented Mar 11, 2023 at 10:55
  • 1
    It's called hyperbaton (inversion of word order for emphasis), and it's a rather common English idiom, @chivracq. See english.stackexchange.com/q/25508 and english.stackexchange.com/q/27420
    – Cody Gray Mod
    Commented Mar 11, 2023 at 11:52
  • Hum indeed, right you are!, fair enough then, I didn't know this "hyperbaton" (FF110 Spell-Checker doesn't even know that word itself neither, ah-ah...!) construction... Thanks for the "demystification" then...! Many non-English native speakers (including myself) on the Site though, I would think using "simpler" grammatical constructions would maybe make the content "easier" to understand for everybody, in a technical context... The accepted Answer to the 1st Thread you linked to is hilarious actually...! // (Remove the Comments as you wish...)
    – chivracq
    Commented Mar 11, 2023 at 13:19
  • I would only call that idiom "common" in highly educated speech aiming for a specific poetic effect. Reading that answer on English.SE, it comes across that the iambic pentameter of "to bolder wax (and more archaic seem)" was accidental. Pity. Commented Mar 12, 2023 at 20:55
  • It's pretty common in my experience. Heck, I even see it in titles of blog posts. It's hardly obscure, and, more importantly, it doesn't obscure the meaning of the sentence.
    – Cody Gray Mod
    Commented Mar 14, 2023 at 6:58
2

The main problem is that I can't figure out what parts of the HTML are important

Before attempting to post, learn technique for figuring this out.

Here is a simple way to start: first, make sure the HTML is syntactically valid (all the opening tags match up in the appropriate way with a corresponding close tag, and are nested in a way that makes sense).

Then, try deleting a complete tag (from the opening to the matching close), and viewing the result again. Aim for something that will remove close to half of the document, if possible. Does the problem still occur? If yes, then we have already successfully improved the example. If no, then the removed part is apparently necessary to cause the problem. Put it back, and try removing something else. As a shortcut, try removing everything else at the same level, first (to see if the problem is specific to that first tag, or if there need to be multiple tags in the same context to cause the problem, or just what).

Keep going until you have removed as much as you can figure out how to remove, while still demonstrating the problem. Work from larger to smaller removals, if possible. After simplifying the tag structure, see if you can do things like shortening the text within tags, or simplifying tag attributes, while still showing the problem.

Also read https://stackoverflow.com/help/minimal-reproducible-example and https://ericlippert.com/2014/03/05/how-to-debug-small-programs/.

As another hint: Do you expect the page to look a certain way, if JavaScript is disabled? Is the result wrong if you do that? Does that demonstrate the problem you want to ask about? If so, then we don't need the JavaScript to reproduce the problem, therefore, we don't need the JavaScript in the code example.

On the other hand: it seems like the point of the JavaScript is to make some changes to some tag attributes, and possibly add some content. Does it make the changes that you want it to? (Load the page and look at the resulting DOM in the browser's inspector; does it look like the JavaScript did what you wanted it to do?)

Based on that, I see two likely possibilities:

  1. the question is about the result of running the Javascript - so instead of showing us the original, show us the DOM that you get (and, again, try to reduce that).

  2. the question is about the JavaScript, because the DOM ends up wrong. So, the next step is to try to debug the JavaScript itself - carefully check, step by step, what happens when that code runs; and see where that differs from your expectation.

1
  • I've also asked this question to my creators, and they've found the answer: apparently, normal margins don't work for TD, but there's a table property that has the effect that they should have
    – Orisphera
    Commented Mar 12, 2023 at 13:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .