+ 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.
11 Answers
+ 7
Thank you! I'll check it out!
+ 6
Hi Jelena! according to the question - yes it is possible. Check what a twig template engine is :). Have fun.
+ 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
+ 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*/
}
+ 2
hi Jelena...its not possible to use if else in plain HTML
+ 2
Wow this is awesome I like it
+ 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!
+ 1
Tell me which is the best language for huckers
+ 1
The best language for hackers are Assembler or Macro Assembler. But you can use MS ACCESS or MS EXCEL for writing some Macro.
+ 1
The best language for hackers are Assembler or Macro Assembler. But you can use MS ACCESS or MS EXCEL for writing some Macro.
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.