- This topic is empty.
-
AuthorPosts
-
March 10, 2012 at 4:38 pm #37086
dcstover1
MemberIm a noob trying to create css containers with 2 background colors. One for the main body and one for the title tag top. Much like how all wordpress admin containers appear. Ive got the one background color working, but the H2 background color does not work…does anbody know of a way around this? I tried making another container and wrapping the h2 titles with it, but then the padding of the inpostbox container sqeezed it. Tried the z-index attribute as well, no such luck there either. Thanks for the help guys
.inpostbox {
padding:0px 6px 4px 6px;
border: 1px solid #dddddd;
H2 { background-color: #000080 }
font: courier;
background-color:#f6f7f9;
-webkit-border-radius: 5px;
-moz-border-radius:
5px;border-radius: 5px;
-webkit-box-shadow: 0 8px 6px -6px black;
-moz-box-shadow: 0 8px 6px -6px black;
box-shadow: 0 8px 6px -6px black;}March 10, 2012 at 4:46 pm #98719dcstover1
Memberor another example is exactly like how this container is setup, with the title “two toned css container” being a darker blue then the body of the container
March 10, 2012 at 5:02 pm #98721dcstover1
Memberive tried that…the container padding scrunches the background color of the h2 and looks horrid
March 10, 2012 at 5:12 pm #98723dcstover1
Memberhttp://www.ontariobuyersmarket.ca/exclusive-properties/
thats with the code you just gave me, notice the padding screwing it up
March 10, 2012 at 5:39 pm #98727dcstover1
Memberstill a no go…the margin trick only worked on one side but then its not padded either…it didnt have the border radius along with it so i added it..ill leave it up for awhile..thanks for helping though, I appreciate it!
March 10, 2012 at 6:01 pm #98731joshuanhibbert
MemberJust use your original code, and some negative margin to counteract the padding on the parent element.
March 10, 2012 at 6:23 pm #98734dcstover1
Memberthe h2 background doesnt even show up using my original code
March 10, 2012 at 6:31 pm #98736karlpcrowley
ParticipantI think I may be way off, not sure if I know whats going on here
but why not put the padding in the h2like this?
http://jsfiddle.net/rPSyx/March 10, 2012 at 6:45 pm #98737dcstover1
Membertried that as well, if i do that then the rest of the container’s contents do not have a padding
March 10, 2012 at 6:46 pm #98738karlpcrowley
Participantput the rest of the contents inside a paragraph and give the paragraph padding?
March 10, 2012 at 6:47 pm #98739dcstover1
Memberhttp://www.ontariobuyersmarket.ca/exclusive-properties/
i see how it works for you in that program, but doesnt here, ive uploaded your code, take a look
March 10, 2012 at 6:48 pm #98740karlpcrowley
ParticipantThat doesn’t have the paragraph though?
March 10, 2012 at 6:50 pm #98742dcstover1
Memberalso for some reason now the drop shadow is now lost and the light grey background is gone
March 10, 2012 at 6:53 pm #98744karlpcrowley
ParticipantMy bad, I had put the p style in the wrong place in the css
Is this what you’re going for?
http://jsfiddle.net/rPSyx/1/March 10, 2012 at 7:09 pm #98745dcstover1
Memberya my bad as well, i didnt have the
‘s in place…all is good now except the boarder on the h2 background color…heres what i got…
.inpostbox {
padding:0px;
border: 1px solid #dddddd; margin: 5px;font: courier;
background-color:#f5f5f8;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 8px 6px -6px black;
-moz-box-shadow: 0 8px 6px -6px black;
box-shadow: 0 8px 6px -6px black;}
H2 { background-color: #9db3c5; padding: 8px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
-moz-border-radius-bottomright: 0px;
-moz-border-radius-bottomleft: 0;
}
h3 { padding:8px;}
P{padding: 8px; } -
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.