Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPaula Mourad
5,154 PointsStyling JS
Will we learn how to style alert boxes and prompt boxes in this course? If not, where can I learn this? Thanks!
3 Answers
Jennifer Nordell
Treehouse TeacherHi there! The alert and prompt boxes are system objects and as such, are not subject to CSS. Essentially, you would have to make a new HTML object that mimics the alert() and prompt() boxes and style them with CSS there. As I understand it, you can use jQuery modals to do a lot of the work for you in this regard.
Take a look at this post on stack overflow.
Hope this helps!
miikis
44,957 PointsHi Paula,
There's no real API for customizing the styling of default browser notification systems like alert(), prompt() and confirm(). Instead, you could create your own. Essentially, an alert box is just a small, rectangular div, presented modally, in the center of the window. Or you could just use a pre-built, cookie-cutter solution, like Bootstrap's Modals.
Paula Mourad
5,154 PointsThanks both Jennifer and Mikis!