HTML/CSS Ok, I need a new thread for my HTML processing program

Click For Summary
The discussion emphasizes the importance of structuring CSS effectively, moving away from inline styles that resemble direct formatting in word processors. It advocates for a method where CSS classes are dependent on one or two levels of HTML structure, allowing for cleaner and more maintainable code. The approach encourages tagging elements appropriately, similar to how one would format a document by categorizing text types, rather than applying styles directly to each element. The poster plans to document their process of writing helper functions and welcomes constructive criticism as they refine their approach.
Jamin2112
Messages
973
Reaction score
12
My old thread was getting messy and I realized I needed to go back to square 1 and write up a plan. So here's an outline of the plan:
23m5t04.jpg


2t5r7.jpg


I will add to this thread as I write the helper functions and encounter any problems. Criticism greatly appreciated.
 
Technology news on Phys.org
And here's my self-explanatory procedure for writing the formatted CSS into a string:

2uq2mo1.jpg
 
Im not really sure if this is relevant for you or not, but in general you would probably not want to structure a CSS file like you do above. If you do, then it is similar to inserting style="" attributes on each elements (this is similar to the naive way of formatting a word document by applying style directly to each chunk of text).

CSS usually shines best when your style classes only depends on one or two levels of html structure context above the current element, although sometimes more is required when you need to adjust a specific frameworks use of CSS in one particular situation. Using CSS the "right way" is similar to formatting a word document by tagging paragraphs as body text, headlines, etc. and they style those tags instead.
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
Replies
22
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K