Refactoring HTML and CSS [closed] - html

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I know you do commonly refactor code for the back-end to improve it's speed, security or make it more readable for the next person who takes over your project, but do you refactor html and css? Since they are markup languages it doesn't seem so trivial, besides wiping off a few bytes of your code vs the time input looking for alternatives doesn't seem to be worth the effort, especially if you are working on a tight deadline.

There are innumerable things that can increase or decrease page performance. Like with any optimisation though, you should start with where people are seeing problems or slowdown.
On a broader level, reducing payloads to the smallest possible size makes a big difference. This involves gzip, caching, and minification. You can rewrite your code a thousand times but it probably won't end up much smaller if at all than it would if you were to use gzip and minify your CSS — but don't minify HTML as it's too prone to rendering issues.
On a finer level, specific CSS features such as resizing large images and implementing lots of browser-generated gradients and shadows can bring performance down significantly. If you're noticing sluggishness when scrolling then things like this are probably what you need to focus on. Just one image that's 640x480 or more being resized by CSS can bring performance crashing down in some browsers.
Then of course there's latency. Using content distribution networks or at the very least highly optimised servers will ensure your HTML, CSS, JavaScript, and image files are delivered to users and shown as quickly as possible.

Related

Chess move validation in larger than 8x8 board? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am creating a chess variant. The rules and pieces are the same with classic chess. The only different is the size of the board (12x12 instead of 8x8).
My goal is to validate and apply moves only. What options I have aside from writing everything from scratch?
Most popular formats seem to be limited to 8x8 boards only.
I am fine with any popular programming language.
There are three general approaches chess engines take in move generation. In chess programming jargon these are commonly known as:
1)Bitboards
2)Mailbox (chess jargon for arrays with padding)
3)Piece lists
The most common method used today is Bitboards, which unfortunately is not easily modifiable to larger boards. This shouldn't be too bad for you, however. The reason bitboards are the de-facto standard is not because the are the easiest to implement (they are in fact the most complex), but because they are much faster for move generation (and by extension validation). However, this is only pertinent for use in a search function that needs to validate moves tens of millions of times per second. If you just want good old simple move validation, the method two should be more than adequate, and easily adaptable to larger boards. If you want to see chess engines that utilize this method, look up engiines that use a mailbox or oX88 board representation. I think the didactic CPW engine uses mailbox.
https://chessprogramming.wikispaces.com/CPW-Engine
and here is an article about move generation:
https://chessprogramming.wikispaces.com/Move+Generation

Should we put all css inside HTML document? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I'm trying to make a Site enhancement.
The Bootstrap.min.css took 0.5 second to load complete to our website.
I thinks solve the 0.5 by place all minified CSS in my HTML Document (In production mode). It's a good idea for run-time enhancement ? Does it make HTML Engine slow to load the CSS ?
That depends on your page. Besides a zillion of factors that influence the page speed, two factors are most important in regards to your question.
bandwidth
amount of requests
If you have one of those single page angular websites for example, then putting all css into your html makes sense. This will reduce the amount of requests, while the bandwidth consumption stays the same.
If you have a "normal" website, with the user loading a new html page every time he clicks on a link, then its better to put the css into .css files, so he doesnt have to load the same information over and over again. This will increase the amount of requests, while dramatically reducing the bandwidth consumption (because of browser side caching of the css).
If you want to increase the speed of your website, look into caching, CDN's and tools like those explained here, which will guide you into the right direction: https://developers.google.com/speed/pagespeed/

What's cons for using too many responsive media screen query [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I want my desktop to mobile site change flawlessly. So my design for the site it has to be good for any screen resolution size. This causing me using a lot of media query screen. Let say for max 990px, max 800px, max 600px etc. Closer to smaller size, it get a lot of media screen. If possible, I'm using percent, but if not possible, I'll use lots of media screen query. Maybe in total on a single page there's 20 or more media query in total (main css style and plugins)
Is there any set back to this? Any cons? Thanks for the reply.
In short
maintainability
Long document and complex syntax reduces readability and increase pain and effort to modify CSS rules in the future.
performance
Too many media queries add length, longer CSS file would cause user spend more time downloading them into the browser and render the correct view.
For the sake of 'you in the future', design and structure the layout cross varied devices carefully. Some tools like "include-media" and "sass-mq" will surely enhance the readability and save work time as well.

Current usefulness of semantically correct HTML [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm working on a new website, and I'm trying to decide how I want to balance the need for semantic correctness, with other important stuff, like development time. I know that semantics are supposed to be important for SEO, and accessibility for blind people. And those are important to me, and shouldn't take too much extra time. So I'll design them in, from the beginning. Anyway, my question is, what else is semantic correctness currently useful for? If there's something else I may consider worthwhile, I'd rather spend a little extra time now to build it in, than wait until later, when it may be more difficult.
Also, I know there are a lot of future possibilities. Some good, and some not (I've seen all the Terminator movies:). But I'll wait and see what happens with those.
edit: I should have mentioned that supporting some old browsers is important for this project, so being semantically correct won't be easy. Especially since I haven't done a lot of browser programming.
I did some more research, so now I can answer my own question.
Other than making sure my site is accessible to disabled people and search engines, there isn't currently anything all that important about semantic correctness, for my project. And I think search engines and screen readers are sophisticated enough these days, to handle some incorrect semantics, as long as the content structure isn't too confusing.
I can see semantic HTML elements being useful for documentation though, as long as it doesn't complicate my code.

best HTML and CSS markup practices for websites where mobile design is different [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
So I'm requesting a solution to markup practices. I am working on an administrator back end design, now I am looking to not necessarily work with responsive design but have completely different behaviour.
Would it be better to use an entirely different site?
Should I include both desktop and mobile HTML and hide/show accordingly with media queries?
What is generally the best way to setup for this and what method to approach as I need the designs to be different in terms of HTML and CSS but I want to have good standards of practice.
As I understand it, you are looking for the best mobile optimization methods. There are a number of solutions to this problem. Peronally, most of what I design isn't meant to be used on mobile devices because of the nature of it, but I try and follow these habits:
1:Use percentages/ems for measurements (height, width, margin). These are adjustable, and will render at least decently on a mobile device. Build a website using only px measurements, and you're screwed.
2:make sure your code is compatible with chrome, firefox, and safari. these are the most common mobile browsers.
ALSO
Having separate sites is acceptable, but i wouldn't recommend it, because any updates you do to one site, you have to do to the other, which could get tedious. As I understand it, it would be better to use media queries(from what I know, there are multiple CSS and/or javascript libraries/frameworks for this) and based on whether it's a mobile device, apply different stylings.
It might be just me but if you're going to write a website, do it properly ONCE. There's a fundamental programming rule Don't Repeat Yourself (DRY) which I like to live by. The best way to achieve this is using media queries and percentage values. Media queries allow you to have completely different styles based on device size and moving forward with web design, something definitely worth investing your time in.