Codelab Editor
Free Online HTML Editor
Run
Learn CSS
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>jQuery css() Clear Inline Styles Example</title> <style> body { font-family: Arial, sans-serif; padding: 40px; background-color: #f9f9f9; } h1 { color: #333; } .content-box { padding: 20px; background-color: #fff; border: 1px solid #ccc; border-radius: 6px; margin-top: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); } #box { width: 150px; height: 150px; margin-bottom: 15px; transition: all 0.3s ease; border: 2px solid #F44336; display: flex; border-radius: 10px; align-items: center; justify-content: center; } button { padding: 10px 20px; background-color: #F44336; color: white; font-size: 14px; border: none; border-radius: 4px; cursor: pointer; margin-right: 10px; } button:hover { background-color: #D32F2F; } </style> <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script> </head> <body> <h1>Remove Inline Styles by Clearing Values</h1> <p>First we apply an inline background color, then clear it by setting it to an empty string.</p> <div class="content-box"> <div id="box">Styled Box</div> <button id="applyStyleBtn">Apply Background Color</button> <button id="clearStyleBtn">Clear Inline Style</button> </div> <script> $(document).ready(function() { $('#applyStyleBtn').click(function() { // set an inline background color $('#box').css('background-color', '#FFEB3B'); }); $('#clearStyleBtn').click(function() { // remove the inline background-color $('#box').css('background-color', ''); }); }); </script> </body> </html>
Editor Commands
Ctrl
F
Find
Ctrl
G
Find Next
Ctrl
⇧
G
Find Previous
Ctrl
⇧
F
Find & Replace
Ctrl
]
Indent Code Right
Ctrl
[
Indent Code Left
⇧
Tab
Auto Indent Code
Ctrl
/
Line Comment
Ctrl
Alt
/
Block Comment
TutsInsider Actions
Alt
S
Run Code
Ctrl
C
Copy Editor Code
Ctrl
A
Select All Editor Code
Ctrl
S
Save/Download
Ctrl
Alt
X
Rotate
Ctrl
Alt
T
Switch Theme
Ctrl
⇧
C
Open Console
Esc
Close Console