In terms of web design, how do you prevent a lightbox taking on the CSS style for the whole webpage?

When developing a website and want users to click thumbnail images and the the bigger version of the image opens up in a lightbox but because of the css for the website the image is off to the right instead of in the middle of the lightbox box.

How do you prevent the lightbox taking on the CSS style for the rest of the website so that the images display properly in the lightbox?

Have you tried assigning a css style to the lightbox div if you are using one.

This should override your other css and allow you to format it the way you want.

i think u should make different style for your lightbox
ex :

.lightbox {
    text-align: center;
    etc ....
}
.lightbox image {
   border: 0;
   etc ....
}

so it will not affect your main image class

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.