+ 8

Is it possible to use if else statement with plain HTML?

Is it possible to make a selection at the beginning of the page and display different results based on the answer? For example: Ask a simple yes/no question and if the answer is YES display the page with blue background else (if the answer is NO) use red background.

2nd Nov 2018, 8:56 PM
Jelena Zjacic
Jelena Zjacic - avatar
11 Answers
+ 7
Thank you! I'll check it out!
2nd Nov 2018, 10:20 PM
Jelena Zjacic
Jelena Zjacic - avatar
+ 6
Hi Jelena! according to the question - yes it is possible. Check what a twig template engine is :). Have fun.
2nd Nov 2018, 10:11 PM
Eterxoz
Eterxoz - avatar
+ 6
It depends on how they answer the question. If you pose the question like: <p>Can you jiggy with it? </p> <a href="yes.html">Yes</a> <a href="no.html">No</a> Then you will want to use CSS (inline styles or internal stylesheet) to produce the different background colors in the yes and no files each (blue and red respectively. But while you're using CSS, you might as well check out what CSS3 has to offer by way of variables and "functions". https://www.w3schools.com/cssref/func_var.asp https://www.w3schools.com/cssref/css_functions.asp
2nd Nov 2018, 11:23 PM
Janning⭐
Janning⭐ - avatar
+ 5
You can use CSS, But SCSS or Sass; CSS Propessors. You can do like; @if (margin:0;){ margin:100 } @else { margin: 0; } Or Without Sass or SCSS; @media screen and (max-width:10){ background: #aaa;/*Gray*/ } @media screen and (max-width: 100){ background: #ddd;/*Different Gray*/ }
23rd Nov 2018, 2:16 PM
Potato Hacker
Potato Hacker - avatar
+ 2
hi Jelena...its not possible to use if else in plain HTML
7th Dec 2018, 12:50 PM
Black hawk
Black hawk - avatar
+ 2
Wow this is awesome I like it
8th Feb 2019, 9:28 AM
Sebagala Isaac
Sebagala Isaac - avatar
+ 2
Sebagala Isaac I'm not sure... I don't work much on ships. https://en.m.wiktionary.org/wiki/hucker#Noun If that was a typo for "hackers", I think you'll find some useful responses via the search feature. In the meantime, if you can't find what you need in existing threads, please feel free to post your questions in new threads so we can keep answers to individual threads topical. You may also find it helpful to review the following: https://www.sololearn.com/Blog/38/8-simple-rules-to-get-help-from-the-community/ Be sure not to miss the link to the Community Guidelines toward the bottom of the article. Happy coding!
8th Feb 2019, 2:52 PM
Janning⭐
Janning⭐ - avatar
+ 1
Tell me which is the best language for huckers
8th Feb 2019, 9:29 AM
Sebagala Isaac
Sebagala Isaac - avatar
+ 1
The best language for hackers are Assembler or Macro Assembler. But you can use MS ACCESS or MS EXCEL for writing some Macro.
25th Feb 2019, 2:36 PM
Aleksandar Nedeljkovic
Aleksandar Nedeljkovic - avatar
+ 1
The best language for hackers are Assembler or Macro Assembler. But you can use MS ACCESS or MS EXCEL for writing some Macro.
25th Feb 2019, 2:36 PM
Aleksandar Nedeljkovic
Aleksandar Nedeljkovic - avatar
0
I am not sure about the if else but you can use the alternate method using <a> tag to get the same result as you want.
7th Apr 2019, 3:39 PM
Sahil Srivastava
Sahil Srivastava - avatar