WEBLEB
Accueil
Éditeur
Connexion
Pro
Français
English
Français
Español
Português
Deutsch
Italiano
हिंदी
calculatrice scientifique
149
ALIDEV
Ouvrir dans l'éditeur
Publiez votre code
Precisa de um site?
Recommandé
15 October 2024
Calculatrice iOS
29 August 2024
Interface utilisateur de la calculatrice - Neumorphisme - blanc
20 August 2024
Calculatrice
HTML
Copy
Scientific Calculator
0
sin
cos
tan
log
ln
AC
DEL
%
/
π
7
8
9
*
e
4
5
6
-
√
1
2
3
+
x
y
0
.
(
)
=
✨ Explain Concept
Mathematical Concept Explanation
×
CSS
Copy
/* Custom styles for the calculator */ body { font-family: 'Inter', sans-serif; /* Using Inter font */ display: flex; justify-content: center; align-items: center; min-height: 100vh; background-color: #f0f2f5; /* Light gray background */ padding: 20px; } .calculator-container { background-color: #ffffff; border-radius: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); padding: 25px; width: 100%; max-width: 400px; /* Max width for desktop */ display: flex; flex-direction: column; gap: 15px; } .display { background-color: #2d3748; /* Darker background for display */ color: #ffffff; font-size: 2.5rem; padding: 20px; border-radius: 15px; text-align: right; min-height: 80px; display: flex; align-items: flex-end; justify-content: flex-end; word-wrap: break-word; overflow-x: auto; /* Allow horizontal scrolling for long results */ white-space: nowrap; /* Prevent wrapping */ -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */ scrollbar-width: none; /* Hide scrollbar for Firefox */ -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */ } /* Hide scrollbar for Chrome, Safari and Opera */ .display::-webkit-scrollbar { display: none; } .buttons-grid { display: grid; grid-template-columns: repeat(5, 1fr); /* 5 columns for scientific functions */ gap: 10px; } .button { background-color: #e2e8f0; /* Light gray for buttons */ color: #2d3748; /* Dark text for buttons */ font-size: 1.3rem; padding: 15px; border-radius: 12px; cursor: pointer; transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s; display: flex; justify-content: center; align-items: center; user-select: none; /* Prevent text selection */ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); } .button:hover { background-color: #cbd5e0; /* Slightly darker on hover */ transform: translateY(-2px); box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15); } .button:active { transform: translateY(0); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } /* Specific button styles */ .button.operator { background-color: #4299e1; /* Blue for operators */ color: #ffffff; } .button.operator:hover { background-color: #3182ce; } .button.equals { background-color: #38a169; /* Green for equals */ color: #ffffff; grid-column: span 2; /* Make equals button span 2 columns */ } .button.equals:hover { background-color: #2f855a; } .button.clear { background-color: #e53e3e; /* Red for clear */ color: #ffffff; } .button.clear:hover { background-color: #c53030; } .button.function { background-color: #a0aec0; /* Gray for functions */ color: #ffffff; font-size: 1rem; /* Smaller font for function names */ } .button.function:hover { background-color: #718096; } /* Responsive adjustments */ @media (max-width: 480px) { .calculator-container { padding: 15px; border-radius: 15px; gap: 10px; } .display { font-size: 2rem; padding: 15px; min-height: 70px; } .buttons-grid { gap: 8px; } .button { font-size: 1.1rem; padding: 12px; border-radius: 10px; } .button.function { font-size: 0.9rem; } } /* Styles for the LLM Modal */ .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out; } .modal-overlay.show { opacity: 1; visibility: visible; } .modal-content { background-color: #ffffff; padding: 30px; border-radius: 15px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2); width: 90%; max-width: 500px; transform: translateY(-20px); transition: transform 0.3s ease-in-out; display: flex; flex-direction: column; gap: 15px; } .modal-overlay.show .modal-content { transform: translateY(0); } .modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px; margin-bottom: 10px; } .modal-header h3 { font-size: 1.5rem; font-weight: bold; color: #2d3748; } .modal-close-button { background: none; border: none; font-size: 1.8rem; color: #718096; cursor: pointer; transition: color 0.2s; } .modal-close-button:hover { color: #4a5568; } .modal-body { max-height: 300px; overflow-y: auto; color: #4a5568; line-height: 1.6; } .modal-body p { margin-bottom: 10px; } .loading-spinner { border: 4px solid #f3f3f3; border-top: 4px solid #4299e1; border-radius: 50%; width: 30px; height: 30px; animation: spin 1s linear infinite; margin: 20px auto; display: none; /* Hidden by default */ } .loading-spinner.show { display: block; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .llm-input-container { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; } .llm-input-container input { padding: 12px; border: 1px solid #cbd5e0; border-radius: 8px; font-size: 1rem; color: #2d3748; outline: none; transition: border-color 0.2s, box-shadow 0.2s; } .llm-input-container input:focus { border-color: #4299e1; box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.3); } .llm-button { background-color: #9f7aea; /* Purple for LLM button */ color: #ffffff; font-size: 1.1rem; padding: 12px 20px; border-radius: 12px; cursor: pointer; transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s; display: flex; justify-content: center; align-items: center; user-select: none; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); } .llm-button:hover { background-color: #805ad5; transform: translateY(-2px); box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15); } .llm-button:active { transform: translateY(0); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } /* Style for active key press feedback */ .button.active-key-press { transform: translateY(0); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); background-color: #d1d5db; /* A slightly darker shade for active state */ } .button.active-key-press.operator { background-color: #3182ce; } .button.active-key-press.equals { background-color: #2f855a; } .button.active-key-press.clear { background-color: #c53030; } .button.active-key-press.function { background-color: #718096; }
JS
Copy
/* Custom styles for the calculator */ body { font-family: 'Inter', sans-serif; /* Using Inter font */ display: flex; justify-content: center; align-items: center; min-height: 100vh; background-color: #f0f2f5; /* Light gray background */ padding: 20px; } .calculator-container { background-color: #ffffff; border-radius: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); padding: 25px; width: 100%; max-width: 400px; /* Max width for desktop */ display: flex; flex-direction: column; gap: 15px; } .display { background-color: #2d3748; /* Darker background for display */ color: #ffffff; font-size: 2.5rem; padding: 20px; border-radius: 15px; text-align: right; min-height: 80px; display: flex; align-items: flex-end; justify-content: flex-end; word-wrap: break-word; overflow-x: auto; /* Allow horizontal scrolling for long results */ white-space: nowrap; /* Prevent wrapping */ -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */ scrollbar-width: none; /* Hide scrollbar for Firefox */ -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */ } /* Hide scrollbar for Chrome, Safari and Opera */ .display::-webkit-scrollbar { display: none; } .buttons-grid { display: grid; grid-template-columns: repeat(5, 1fr); /* 5 columns for scientific functions */ gap: 10px; } .button { background-color: #e2e8f0; /* Light gray for buttons */ color: #2d3748; /* Dark text for buttons */ font-size: 1.3rem; padding: 15px; border-radius: 12px; cursor: pointer; transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s; display: flex; justify-content: center; align-items: center; user-select: none; /* Prevent text selection */ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); } .button:hover { background-color: #cbd5e0; /* Slightly darker on hover */ transform: translateY(-2px); box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15); } .button:active { transform: translateY(0); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } /* Specific button styles */ .button.operator { background-color: #4299e1; /* Blue for operators */ color: #ffffff; } .button.operator:hover { background-color: #3182ce; } .button.equals { background-color: #38a169; /* Green for equals */ color: #ffffff; grid-column: span 2; /* Make equals button span 2 columns */ } .button.equals:hover { background-color: #2f855a; } .button.clear { background-color: #e53e3e; /* Red for clear */ color: #ffffff; } .button.clear:hover { background-color: #c53030; } .button.function { background-color: #a0aec0; /* Gray for functions */ color: #ffffff; font-size: 1rem; /* Smaller font for function names */ } .button.function:hover { background-color: #718096; } /* Responsive adjustments */ @media (max-width: 480px) { .calculator-container { padding: 15px; border-radius: 15px; gap: 10px; } .display { font-size: 2rem; padding: 15px; min-height: 70px; } .buttons-grid { gap: 8px; } .button { font-size: 1.1rem; padding: 12px; border-radius: 10px; } .button.function { font-size: 0.9rem; } } /* Styles for the LLM Modal */ .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out; } .modal-overlay.show { opacity: 1; visibility: visible; } .modal-content { background-color: #ffffff; padding: 30px; border-radius: 15px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2); width: 90%; max-width: 500px; transform: translateY(-20px); transition: transform 0.3s ease-in-out; display: flex; flex-direction: column; gap: 15px; } .modal-overlay.show .modal-content { transform: translateY(0); } .modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px; margin-bottom: 10px; } .modal-header h3 { font-size: 1.5rem; font-weight: bold; color: #2d3748; } .modal-close-button { background: none; border: none; font-size: 1.8rem; color: #718096; cursor: pointer; transition: color 0.2s; } .modal-close-button:hover { color: #4a5568; } .modal-body { max-height: 300px; overflow-y: auto; color: #4a5568; line-height: 1.6; } .modal-body p { margin-bottom: 10px; } .loading-spinner { border: 4px solid #f3f3f3; border-top: 4px solid #4299e1; border-radius: 50%; width: 30px; height: 30px; animation: spin 1s linear infinite; margin: 20px auto; display: none; /* Hidden by default */ } .loading-spinner.show { display: block; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .llm-input-container { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; } .llm-input-container input { padding: 12px; border: 1px solid #cbd5e0; border-radius: 8px; font-size: 1rem; color: #2d3748; outline: none; transition: border-color 0.2s, box-shadow 0.2s; } .llm-input-container input:focus { border-color: #4299e1; box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.3); } .llm-button { background-color: #9f7aea; /* Purple for LLM button */ color: #ffffff; font-size: 1.1rem; padding: 12px 20px; border-radius: 12px; cursor: pointer; transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s; display: flex; justify-content: center; align-items: center; user-select: none; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); } .llm-button:hover { background-color: #805ad5; transform: translateY(-2px); box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15); } .llm-button:active { transform: translateY(0); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } /* Style for active key press feedback */ .button.active-key-press { transform: translateY(0); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); background-color: #d1d5db; /* A slightly darker shade for active state */ } .button.active-key-press.operator { background-color: #3182ce; } .button.active-key-press.equals { background-color: #2f855a; } .button.active-key-press.clear { background-color: #c53030; } .button.active-key-press.function { background-color: #718096; }