Box for Text Not Working?
On this page, I'm trying to create a text box around the paragraph that begins "It's important not to...". I used this CSS:
.transbox {
ba开发者_JAVA百科ckground: #F5FBEF;
border: 1px solid #E3F6CE;
padding: 10px;
margin: 10px auto;
}
The text has moved slightly out of line with the other text in the article, but it's not showing how it's supposed to. Any ideas what's wrong?
Your .transbox styles are within CSS comment tags, that is why they are not showing up. Move the styles out of the /* */ tags.
Also, you should note that there are no paragraph tags within the box itself, so .transbox p
will not work.
the text is out of line because your "transbox" is a div
and not a p
- you couljd just code it <p class="transbox">
for it to inherit the other p
CSS, or if their will be more <p>
elements inside this box you need to make the .transbox
CSS (specifically margins) match your p
's
then there is no .transbox
CSS being applied, are you sure your updated CSS above is entered properly (i.e. the case of the classname).. or is the old stylesheet maybe cached and needs a refresh to pick up your added code
精彩评论