[SOLVED] Trying to get: 5 block elements, and the 5 elements below that to stick to the middle element

I got up to this part: https://jsfiddle.net/2n366xLn/3/

Error: Start tag div seen in table.
From line 19, column 5; to line 22, column 59</tr>↩<tr>↩  ↩
<div style="width:266px" onclick="myObject=document.getElementById('myObj'); ↩myObject.style.display='block'; this.style.display='none'">↩↩<td>
Fatal Error: Cannot recover after last error. 
Any further errors will be ignored.From line 19, column 5; to line 22, column 59</tr>↩<tr>↩  ↩<div style="width:266px" onclick="myObject=document.getElementById('myObj'); ↩myObject.style.display='block'; this.style.display='none'">↩↩<td>

This is what you get when you run the code through the html validator.

2 Likes

I need help getting the top code in-between the first and 2nd one: https://jsfiddle.net/2n366xLn/7/

I need help getting the top code in-between the first and 2nd one: https://jsfiddle.net/2n366xLn/7

Please excuse me if this seems condescending, but it would REALLY behoove you to take some time to learn the functions of the specific factions of web development, and how to appropriately apply them.

If you remove ALL of the styling out of the html, and allow css do what it’s supposed to, it’s pretty simple to get what you’re looking for. Your HTML is smaller, easier to maintain, and your css is consistent, smaller and (again) easier to maintain.

7 Likes

It’s not allowed there and browsers don’t have to render it. You need to use td (or th) tags instead of a div at that point in the table. Nothing else is allowed there. You can’t make your own rules up as you go along just to fit your purpose.:slight_smile:

Well that’s not quite true because you can make your own rules up and you might get away with it some of the time but its not correct and some browsers may choose to ignore invalid code although most will try to make some sense of it. The point is that html has rules for a reason and if you want to code properly you must follow those rules. You are doing yourself no favour by ignoring things you don’t like.

Remember these forums are for the community and not just your personal pet project so when people give advice they give advice for all that may be watching. We cannot risk (intentionally) handing out broken code because other beginners will be confused and accept what they see as good coding. We are here to help people learn but not specifically do their work for them (although sometimes we do). However when we offer code we will offer the correct code and expect you to learn from it. Of course it’s up to you whether you choose to follow the advice or not but it can be rather irritating to see the same mangled code appearing in many posts as it seems our help has been wasted. Sorry for the short rant.

9 Likes

Then how was I able to do it on here? http://testblogty678.blogspot.com/

Strongly recommend you read his response again, in full.

It only works because the browser is trying to fix your inability to follow the rules. So it does its best to try and figure out your true intent. However, there is zero promise that code will work in the future. The browser may one day say, I’m tired of guessing intent for this scenario and choose to not render it or render it differently. In which case, your page breaks.

So yes, it may work for now, maybe even in all browsers (if you’re lucky), but unless you follow the HTML spec, there is zero guarantee that it will continue to work in the future.

4 Likes

When I put it into browsers shots it works the same in all of them.

See: http://i.imgur.com/fjYFS0q.png

If you refuse to read anything in full there isn’t anything we can help you with here. Best of luck on your adventures though.

Are you saying one day computers will cease to read inline css, or html code?

No (though I suppose they might)

What is being said is that it is very likely that not all browsers do, or will continue to, “fix” broken code the way you might hope they do.

Take the inline CSS and JavaScript out of the HTML tags and keep it out of them.

1 Like

If the code is broken like you say it is, then why does it work? https://jsfiddle.net/ccgmuwyq/

Because you have been lucky in the limited amount of testing that you’ve done.

Up to you. If you prefer to rely on “luck” and uncertainty it’s your choice.

If this is for your own personal website, not so much a problem losing visitors.

But if this is for a client, prepare for some “conversations” at some point.

You have to test properly in all browsers to be certain - particularly since there is nowhere to get screen images for 99%+ of the thousands of different browsers out there.

So you might have something that shows your code working in 5 browsers and it might not work in the next 1995 browsers you look at.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.