code structure helpppp
anyone know how to improve on code structure?my website have only html,css and java.HTML and CSS are my main concern tho its a whole mess with a bunch of elements constant overriding each other and i just name random shit to my classes name like nba1 or abr1
14 Replies
well, since you're using java, why dont you organize the files as suggested by the framework you're using?
I'm assuming they mean Javascript
in that case, can you show us how the files are right now?
We can't comment on things we haven't seen.
What does your code structure look like now? What do you mean "a bunch of elements constant overriding each other"?
Although I can tell you now with 100% certainty that if you "just name random shit to my classes name like nba1 or abr1" then it'll be bad. Your names should be descriptive of what the class does. Or if you're using an ID then the ID should uniquely identify the element.
yooo thanks alot
what i mean by constant overriding is my media queries is very long,like just for it to be barely responsive on an phone
that is a very different issue
yeah mb
and in my experience, it's easier to gut it all and start over
how to organize the files tho
i have 3 files html css and javascript
others is just images i drag into vscode
give this free course a look https://courses.kevinpowell.co/conquering-responsive-layouts
Kevin Powell
Conquering Responsive Layouts
Are you ready to take the challenge and finally figure out responsive layouts? Click the button below and jump in!
oh
thanks alot bro
Before you worry about organizing the files you should make sure the file content is good. Otherwise you’re just kicking the can down the road.
With the HTML it’s easy: each file is a different page.
For CSS, it’s not impossible to import multiple files but it’s best to only do one CSS file if you can. And keep the declarations tight and descriptive. Each CSS declaring needs to add something material and noticeable to the layout.
Another thing to keep in mind is that by default, HTML is responsive on phone and desktop alike! It’s s us, the devs, who make it not so with “fancy” CSS. Remove the CSS link in your HTML files and look at them. Block elements are stacked on top of each other. It might not be pretty but it’s readable and responsive.
You really just need to show us your code if you want us to help. I don't like talking about code in theoretical terms like this, it's not helpful
And if you want help with your file structures then take screenshots of your file outline in whatever IDE you use
how you structure your files depends on what frameworks and development patterns you're using and a single screenshot says more than a thousand words. this is the file structure of one of my projects. just take a screenshot like that and then we actually know what you're talking about and how to answer your questions
