Forum Moderators: not2easy
#top-banner {
width: 966px;
height: 132px;
margin: 0px auto;
margin-top: 0px;
margin-bottom: 0px;
background-image: url(../images/bg-page-title.png);
background-repeat: no-repeat;
background-position: center;
z-index: 20;
margin-top: -100px;
margin-bottom: 30px;
}
#title {
width: 100%;
margin-top: -10px;
padding-top: 0px;
float: left;
text-align: center;
}
@media screen and (-webkit-min-device-pixel-ratio:0) and (min-resolution:.001dpcm) {
#title {
width: 100%;
margin-top: 20px;
padding-top: 0px;
float: left;
text-align:center;
}
}
[edited by: not2easy at 10:19 pm (utc) on Feb 23, 2019]
[edit reason] removed links [/edit]
margin: 0px auto;Say what now?
margin-top: 0px;
margin-bottom: 0px;
<snip>
margin-top: -100px;
margin-bottom: 30px;
<div id="top-banner">
<div id="left-title">
</div>
<div id="title">
<h7>Call FREE today on 1234 567 890</h7>
</div>
</div> #top-banner{
width: 966px;
height: 132px;
margin: 0px auto;
background-image: url('/wp-content/themes/example/assets/images/bg-page-title.png');
background-repeat: no-repeat;
background-position: center;
z-index:20;
margin-top:-100px;
margin-bottom:30px;
}
#title {
width: 100%;
margin-top: -10px !important;
padding-top: 0px;
float: left;
text-align:center;
}
#title h7{
color: #588ae3;
font-size: 22px;
font-weight: bold;
}
#title margin-top:-10px; but on chrome the text is out of position to the top of the image... I need to change the -10px to 20px to get the text to align correctly in chrome. [edited by: not2easy at 12:01 pm (utc) on Feb 24, 2019]
[edit reason] readability [/edit]
margin: 0px auto;Whyyyyy?
margin-top:-100px;
margin-bottom:30px;
margin-top: -10px !important;The moment you find yourself needing to use the label !important you need to step back and figure out why this label seems to be necessary. Almost invariably you will find some other rule that wants the (in this case) margin-top to have some other value, and then you can override the rule more precisely. As in:
display: inline-block; to the container "top-banner" but it doesn't always help when nested divs have variations in width settings. I see that the "top-banner" div is set to "width: 966px;" and contains two other divs. One of those has both "width: 100%;" and "float: left;" but there isn't any css included for the "left-title" div that precedes it so we can't see what effect that has. One of those has both "width: 100%;" and "float: left;"Hm, missed that. Seems like the only conceivable difference between this pair of styles and saying nothing--meaning you'd default to {display: block} assuming it's a div--is that you're offering new opportunities for selected browsers to try to get smart.