I am wanting to align a image div inside of another div. Pretty much have the image sit in the middle with white space above and below.
Here is my code: http://jsfiddle.net/f098xnrk/
<h1><img src="http://i.imgur.com/akaZnwC.png"></h1>
<div id="content">
<div class="Division">
<div class="picture">
<img src="http://i.imgur.com/LXbVyBU.jpg">
</div>
<div class="info">
<h3>brand new bbs wheels</h3>
<h4>brand new pair for sale, comes with no tires or...</h4>
<div class="alignleft">
<div class="price">$1200</div>
</div>
<div class="alignright"><a class="btn" href="part_listing.php?id=39">More Info</a></div>
<div style="clear: both;"></div>
</div>
</div>
</div>
and
.Division {
background: none repeat scroll 0 0 white;
border: 1px solid #ddd;
border-radius: 4px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
display: inline-block;
margin: 5px;
padding: 4px;
width: 280px;
}
.picture {
height: 280px;
width: 280px;
}
.picture img {
width:280px;
}
h1 {
padding-left: 10px;
}
.alignleft {
float: left;
margin: 0;
}
.alignright {
float: right;
margin: 0;
}
.info h3 {
font-size: 20px;
margin: 9px 0;
padding: 0;
}
.info h4 {
font-size: 11px;
margin: 5px 0;
padding: 0;
}
body {
margin: 0 auto;
width: 1245px;
background: none repeat scroll 0 0 #ecf0f1;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
}
#content {
margin:0px auto;
text-align: center;
padding:15px;
background:none repeat scroll 0 0 #fff
}
.info {
text-align: left;
}
.btn {
background: #3498db;
background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
background-image: -moz-linear-gradient(top, #3498db, #2980b9);
background-image: -ms-linear-gradient(top, #3498db, #2980b9);
background-image: -o-linear-gradient(top, #3498db, #2980b9);
background-image: linear-gradient(to bottom, #3498db, #2980b9);
-webkit-border-radius: 5;
-moz-border-radius: 5;
border-radius: 5px;
font-family: Arial;
color: #ffffff;
font-size: 14px;
padding: 10px 20px 10px 20px;
text-decoration: none;
display: inline-block;
width:75px;
text-align:center;
}
.btn:hover {
background: #3cb0fd;
background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);
background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
text-decoration: none;
}
.price {
border: 1px solid #3498db;
-webkit-border-radius: 5;
-moz-border-radius: 5;
border-radius: 5px;
font-family: Arial;
font-size: 14px;
padding: 9px 20px;
text-decoration: none;
display: inline-block;
width:75px;
text-align:center;
}
Thank you for the upcoming help.
Use vertical-align:middle
.Division {
background: none repeat scroll 0 0 white;
border: 1px solid #ddd;
border-radius: 4px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
display: inline-block;
margin: 5px;
padding: 4px;
width: 280px;
}
.picture {
height: 280px;
width: 280px;
display:table-cell; /*.. vertical-align property can be apply for table-cell ...*/
vertical-align:middle; /*... to set image vertically center ...*/
}
.picture img {
width: 280px;
}
h1 {
padding-left: 10px;
}
.alignleft {
float: left;
margin: 0;
}
.alignright {
float: right;
margin: 0;
}
.info h3 {
font-size: 20px;
margin: 9px 0;
padding: 0;
}
.info h4 {
font-size: 11px;
margin: 5px 0;
padding: 0;
}
body {
margin: 0 auto;
width: 1245px;
background: none repeat scroll 0 0 #ecf0f1;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
}
#content {
margin: 0px auto;
text-align: center;
padding: 15px;
background: none repeat scroll 0 0 #fff
}
.info {
text-align: left;
}
.btn {
background: #3498db;
background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
background-image: -moz-linear-gradient(top, #3498db, #2980b9);
background-image: -ms-linear-gradient(top, #3498db, #2980b9);
background-image: -o-linear-gradient(top, #3498db, #2980b9);
background-image: linear-gradient(to bottom, #3498db, #2980b9);
-webkit-border-radius: 5;
-moz-border-radius: 5;
border-radius: 5px;
font-family: Arial;
color: #ffffff;
font-size: 14px;
padding: 10px 20px 10px 20px;
text-decoration: none;
display: inline-block;
width: 75px;
text-align: center;
}
.btn:hover {
background: #3cb0fd;
background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);
background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
text-decoration: none;
}
.price {
border: 1px solid #3498db;
-webkit-border-radius: 5;
-moz-border-radius: 5;
border-radius: 5px;
font-family: Arial;
font-size: 14px;
padding: 9px 20px;
text-decoration: none;
display: inline-block;
width: 75px;
text-align: center;
}
<body>
<h1><img src="http://i.imgur.com/akaZnwC.png"></h1>
<div id="content">
<div class="Division">
<div class="picture">
<img src="http://i.imgur.com/LXbVyBU.jpg">
</div>
<div class="info">
<h3>brand new bbs wheels</h3>
<h4>brand new pair for sale, comes with no tires or...</h4>
<div class="alignleft">
<div class="price">$1200</div>
</div>
<div class="alignright"><a class="btn" href="part_listing.php?id=39">More Info</a>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>
Related
I'm trying to style the jquery UI date picker.
Everything works fine with one exception.
I need to make everything centered but I can't seem to achieve that.
Here what i have so far:
$('#calendar').datepicker({
inline: true,
firstDay: 1,
showOtherMonths: true,
dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
});
.ui-datepicker,
.ui-datepicker table,
.ui-datepicker tr,
.ui-datepicker td,
.ui-datepicker th {
margin: 0;
padding: 0;
border: none;
border-spacing: 0;
}
.ui-datepicker {
display: none;
width: 100%;
padding: 35px;
cursor: default;
text-transform: uppercase;
font-family: Tahoma;
font-size: 24px;
background: #fff;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
border:solid 1px #e91e62;
}
.ui-datepicker-header {
position: relative;
padding-bottom: 10px;
border-bottom: 1px solid #d6d6d6;
}
.ui-datepicker-title { text-align: center; }
.ui-datepicker-month {
position: relative;
padding-right: 15px;
color: #e91e62;
}
.ui-datepicker-year {
padding-left: 8px;
color: #e91e62;
}
.ui-datepicker-month:before {
display: block;
position: absolute;
top: 5px;
right: 0;
width: 5px;
height: 5px;
content: '';
background: #a5cd4e;
background: -moz-linear-gradient(top, #a5cd4e 0%, #6b8f1a 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a5cd4e), color-stop(100%,#6b8f1a));
background: -webkit-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: -o-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: -ms-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.ui-datepicker-prev,
.ui-datepicker-next {
position: absolute;
top: -2px;
padding: 5px;
cursor: pointer;
}
.ui-datepicker-prev {
left: 0;
padding-left: 0;
}
.ui-datepicker-next {
right: 0;
padding-right: 0;
}
.ui-datepicker-prev span,
.ui-datepicker-next span{
display: block;
width: 5px;
height: 10px;
text-indent: -9999px;
background-image: url(../img/arrows.png);
}
.ui-datepicker-prev span { background-position: 0px 0px; }
.ui-datepicker-next span { background-position: -5px 0px; }
.ui-datepicker-prev-hover span { background-position: 0px -10px; }
.ui-datepicker-next-hover span { background-position: -5px -10px; }
.ui-datepicker-calendar th {
padding-top: 15px;
padding-bottom: 10px;
text-align: center;
font-weight: normal;
color: #a8a8a8;
width:100%;
}
.ui-datepicker-calendar td {
padding: 0 7px;
text-align: center;
line-height: 26px;
}
.ui-datepicker-calendar .ui-state-default {
display: block;
width: 26px;
outline: none;
text-decoration: none;
color: #000;
border: 1px solid transparent;
}
.ui-datepicker-calendar .ui-state-active {
color: #e91e62;
border: 1px solid #e91e62;
}
.ui-datepicker-other-month .ui-state-default { color: #ccc; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<div id="calendar">
</div>
If you look at the example above, you will see a gap which is not wanted and the content of the calendar is not really centered!
Could someone please advice on this issue?
Here is a fiddle as well if needed: https://jsfiddle.net/u7cocxdy/2/
any help would be appreciated.
You had a width:100% in there (.ui-datepicker-calendar th), which i deleted. This got rid of the gap. I then used margin: 0 auto to center the table.
$('#calendar').datepicker({
inline: true,
firstDay: 1,
showOtherMonths: true,
dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
});
.ui-datepicker,
.ui-datepicker table,
.ui-datepicker tr,
.ui-datepicker td,
.ui-datepicker th {
margin: 0;
padding: 0;
border: none;
border-spacing: 0;
}
.ui-datepicker {
display: none;
width: 100%;
padding: 35px;
cursor: default;
text-transform: uppercase;
font-family: Tahoma;
font-size: 24px;
background: #fff;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
border: solid 1px #e91e62;
}
.ui-datepicker-header {
position: relative;
padding-bottom: 10px;
border-bottom: 1px solid #d6d6d6;
}
.ui-datepicker-title {
text-align: center;
}
.ui-datepicker-month {
position: relative;
padding-right: 15px;
color: #e91e62;
}
.ui-datepicker-year {
padding-left: 8px;
color: #e91e62;
}
.ui-datepicker-month:before {
display: block;
position: absolute;
top: 5px;
right: 0;
width: 5px;
height: 5px;
content: '';
background: #a5cd4e;
background: -moz-linear-gradient(top, #a5cd4e 0%, #6b8f1a 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #a5cd4e), color-stop(100%, #6b8f1a));
background: -webkit-linear-gradient(top, #a5cd4e 0%, #6b8f1a 100%);
background: -o-linear-gradient(top, #a5cd4e 0%, #6b8f1a 100%);
background: -ms-linear-gradient(top, #a5cd4e 0%, #6b8f1a 100%);
background: linear-gradient(top, #a5cd4e 0%, #6b8f1a 100%);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.ui-datepicker-prev,
.ui-datepicker-next {
position: absolute;
top: -2px;
padding: 5px;
cursor: pointer;
}
.ui-datepicker-prev {
left: 0;
padding-left: 0;
}
.ui-datepicker-next {
right: 0;
padding-right: 0;
}
.ui-datepicker-prev span,
.ui-datepicker-next span {
display: block;
width: 5px;
height: 10px;
text-indent: -9999px;
background-image: url(../img/arrows.png);
}
.ui-datepicker-prev span {
background-position: 0px 0px;
}
.ui-datepicker-next span {
background-position: -5px 0px;
}
.ui-datepicker-prev-hover span {
background-position: 0px -10px;
}
.ui-datepicker-next-hover span {
background-position: -5px -10px;
}
.ui-datepicker-calendar th {
padding-top: 15px;
padding-bottom: 10px;
text-align: center;
font-weight: normal;
color: #a8a8a8;
}
.ui-datepicker-calendar td {
padding: 0 7px;
text-align: center;
line-height: 26px;
}
.ui-datepicker-calendar .ui-state-default {
display: block;
width: 26px;
outline: none;
text-decoration: none;
color: #000;
border: 1px solid transparent;
}
.ui-datepicker-calendar .ui-state-active {
color: #e91e62;
border: 1px solid #e91e62;
}
.ui-datepicker-other-month .ui-state-default {
color: #ccc;
}
.ui-datepicker table {
margin: 0 auto;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<div id="calendar">
</div>
I'm trying to center text in my button. I tried text-center: center; but it didn't help.
<button id="test" class="btn1" style="margin-left:8px;">Button 1</button>
css:
.btn1 {
display: inline-block;
border: 1px solid #ccc;
text-decoration: none;
word-wrap: normal;
vertical-align: middle;
text-center: center;
cursor: pointer;
border-radius: 2px;
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
padding: 0 6px 0 5.5px;
height: 24px;
color: #6D6D6D;
background-color: #fafafa;
font-size: 11px;
font-family: "Roboto";
font-weight: 500;
}
.btn1:before {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAACXBIWXMAAAsSAAALEgHS3X78AAAAq0lEQVRYhe3ZOw7CQBCDYXuziRBISOH+FbfiAogKKlLsJhkKHhWNq2zhTz7Ar2mHl+t5ONxjzUBge2Say/OUh/1jd7zF2jeTVRHMEV2sfTvXAhDRvWt+a0EAkbaO+M9ZCmcpnKVwlsJZCmcpnKVwlsJZCmcpnKVwlsJZCmcpnKVwlsJZCmcpnKVwlsJZigzwuxZ8YjK5MFUAbbyiyFTJJZdpBKOdxx3TXKbxBb7NLc+2MdrpAAAAAElFTkSuQmCC') no-repeat left center transparent;
background-size: 100% 100%;
width: 14px;
height: 14px;
content: '';
display: inline-block;
vertical-align: middle;
margin-bottom: 1px;
margin-left: 3px;
margin-right: 8px;
}
.btn1:hover {
background: black;
background-image: -webkit-linear-gradient(top, #f7f9fa, #eff5f7);
background-image: -ms-linear-gradient(top, #f7f9fa, #eff5f7);
background-image: -o-linear-gradient(top, #f7f9fa, #eff5f7);
background-image: linear-gradient(to bottom, #f7f9fa, #eff5f7);
}
It needs moving text down by 1 px
https://jsfiddle.net/8dz1tfw7/1/
Will advised to use flex for that button
.test.btn1 {
display: flex;
align-items: center;
}
see below
.btn1 {
/**display: inline-block;**/
display: flex;
align-items: center;
border: 1px solid #ccc;
text-decoration: none;
word-wrap: normal;
vertical-align: middle;
text-center: center;
cursor: pointer;
border-radius: 2px;
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
padding: 0 6px 0 5.5px;
height: 24px;
color: #6D6D6D;
background-color: #fafafa;
font-size: 11px;
font-family: "Roboto";
font-weight: 500;
}
.btn1:before {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAACXBIWXMAAAsSAAALEgHS3X78AAAAq0lEQVRYhe3ZOw7CQBCDYXuziRBISOH+FbfiAogKKlLsJhkKHhWNq2zhTz7Ar2mHl+t5ONxjzUBge2Say/OUh/1jd7zF2jeTVRHMEV2sfTvXAhDRvWt+a0EAkbaO+M9ZCmcpnKVwlsJZCmcpnKVwlsJZCmcpnKVwlsJZCmcpnKVwlsJZCmcpnKVwlsJZigzwuxZ8YjK5MFUAbbyiyFTJJZdpBKOdxx3TXKbxBb7NLc+2MdrpAAAAAElFTkSuQmCC') no-repeat left center transparent;
background-size: 100% 100%;
width: 14px;
height: 14px;
content: '';
display: inline-block;
vertical-align: middle;
margin-bottom: 1px;
margin-left: 3px;
margin-right: 8px;
}
.btn1:hover {
background: black;
background-image: -webkit-linear-gradient(top, #f7f9fa, #eff5f7);
background-image: -ms-linear-gradient(top, #f7f9fa, #eff5f7);
background-image: -o-linear-gradient(top, #f7f9fa, #eff5f7);
background-image: linear-gradient(to bottom, #f7f9fa, #eff5f7);
}
<button id="test" class="btn1" style="margin-left:8px;"><span>Button 1</span></button>
Try adding
vertical-align: center;
Instead of
vertical-align: middle;
my div background color is not showing in chrome and I'm getting this error in W3C css validator:
16 .myfiles Value Error : background-color Parse Error background-color= #e9e9e9
This is the div implementation:
<div class="myfiles">
<table class="center">
<h2>My Files</h2>
<?php
$dir = "./userFiles/".$login;
$files = array_diff(scandir($dir), array('..', '.'));
foreach($files as $ind_file){
?>
<tr><td><a href="<?php echo $dir."/".$ind_file;?>"><?php echo $ind_file;?></td></tr>
<?php
}
?>
</table>
</div>
Here is my css file:
body {
margin-top: 0px;
width: 100%;
height: 100%;
background-image: url("bg.jpg");
font-family: Arial, Helvetica, sans-serif;
font-size : 14px;
}
h2{
text-align: center;
color:#C64934;
margin-bottom:5px;
}
.myfiles{
height: 50%;
background-color= #e9e9e9;
}
.center {
margin-left: auto;
margin-right: auto;
}
#save{
background: #3498db;
background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
background-image: -moz-linear-gradient(top, #3498db, #2980b9);
background-image: -ms-linear-gradient(top, #3498db, #2980b9);
background-image: -o-linear-gradient(top, #3498db, #2980b9);
background-image: linear-gradient(to bottom, #3498db, #2980b9);
-webkit-border-radius: 4;
-moz-border-radius: 4;
font-family: Arial;
color: #ffffff;
font-size: 14px;
padding: 6px 30px 6px 30px;
}
#save:hover{
background: #3cb0fd;
background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);
background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
}
#result {
margin-left: 80px;
border: 1px solid #cccccc;
width: 270px;
background: #E9ECEF;
font-family: Arial, Helvetica, sans-serif;
font-weight:bold;
font-size : 12px;
padding:5px;
margin-bottom:10px;
}
.text {
border: 1px solid #cccccc;
}
input::-webkit-input-placeholder{
color:grey;
}
.values{
font-family: verdana;
font-weight:normal;
font-size : 10px;
}
.key{
font-family: verdana;
font-weight:bold;
font-size : 12px;
padding-bottom:15px;
}
#nav1 {
margin-top: 0px;
list-style-type: none;
float: right;
font-weight: bold;
}
#nav1 li{
display: inline;
padding-right: 20px;
vertical-align: middle;
}
table {
display: table;
border-collapse: separate;
border-spacing: 10px;
}
a, a:visited, a:link {
color: #A21313;
text-decoration: none;
}
So the problem is that the background-color in my .myfiles class is not working.
I tried to fix it by specifying the height of the div but it didn't work.
Please help me.
You wrote background-color= #e9e9e9;, should be background-color: #e9e9e9;.
Change background-color= to background-color:
You have to change the "=" to ":" in myfiles class.
I have a dropdown menu on the top of a page like so:
CSS:
div#navwrapper {
position: relative;
clear: both;
width: 100%;
height: 35px;
line-height: 35px;
letter-spacing: 1px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
background: rgb(255,255,255); /* Old browsers */
background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(241,241,241,1) 50%, rgba(225,225,225,1) 51%, rgba(246,246,246,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(50%,rgba(241,241,241,1)), color-stop(51%,rgba(225,225,225,1)), color-stop(100%,rgba(246,246,246,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(241,241,241,1) 50%,rgba(225,225,225,1) 51%,rgba(246,246,246,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(241,241,241,1) 50%,rgba(225,225,225,1) 51%,rgba(246,246,246,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(241,241,241,1) 50%,rgba(225,225,225,1) 51%,rgba(246,246,246,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(241,241,241,1) 50%,rgba(225,225,225,1) 51%,rgba(246,246,246,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f6f6f6',GradientType=0 ); /* IE6-9 */
}
div#coachnavigation {
width: 990px;
margin: 0 auto;
font-weight: bold;
}
#coachnavigation .firstli {
background-image: url('../coach/images/logo_tsa.png');
background-repeat: no-repeat;
text-align: right !important;
padding-left: 35px;
}
#coachnavigation .down {
background-image: url('../images/button_down.png');
background-repeat: no-repeat;
background-position: 95% 50%;
padding-right: 26px;
}
div#searchbar {
clear: both;
float: left;
width: 975px;
height: 28px;
line-height: 28px;
background-color: #164a98;
padding-left: 15px;
color: #fff;
}
#searchbar a {
color: #fff;
}
#box
{
line-height: 32px;
}
#box .field
{
background: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0%, #FEFFFE),
color-stop(100%, #BDBDBD)
);
height: 20px;
margin: 0px;
-webkit-border-radius: 25px;
}
#box .field input[type=text]
{
padding: 2px 2px 2px 25px;
border: 0;
-webkit-border-top-left-radius: 25px;
-webkit-border-bottom-left-radius: 25px;
margin: 0;
outline: 0;
width: 144px;
height: 20px;
float: left;
background: url('images/magnifier.png') 7px 5px no-repeat;
border: 1px solid #333333;
color: #333333;
}
#box .field input[type=submit]
{
float: left;
background: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(100%, #C6C6C6),
color-stop(0%, #8F8F8F)
);
border: 1px solid #606060;
width: 60px;
height: 26px;
padding: 2px 0 2px 0;
-webkit-border-top-right-radius: 25px;
-webkit-border-bottom-right-radius: 25px;
margin: 0 0 0 -1px;
opacity: 0.9;
cursor: pointer;
text-shadow: 1px 1px 0 #DBDBDB;
}
.coachnavmenu>li>ul>li>ul>li { width: 400px; }
.coachnavmenu,
.coachnavmenu ul,
.coachnavmenu li
{
padding: 0px;
margin: 0px;
z-index: 2;
text-align: right;
}
.coachnavmenu > li
{
float: left;
}
.coachnavmenu li
{
list-style-type: none;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
line-height: 30px;
letter-spacing: 0px;
color: #333333;
border-right: 1px inset #f6f6f6;
padding: 5px 12px 0px 12px;
}
.coachnavmenu > li li
{
list-style-type: none;
text-align: left;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
border: 1px solid #f6f6f6;
color: #333333;
background-color: #f6f6f6;
padding: 0 20px 0 4px;
}
.coachnavmenu ul
{
display: none;
position: absolute;
margin-left: -15px;
margin-top: -1px;
}
.coachnavmenu li:hover > ul
{
display: block;
}
.coachnavmenu ul.parent_hover
{
display: block;
}
.coachnavmenu a
{
color: #333333;
line-height: 100%;
width: 100%;
text-decoration: none;
}
.coachnavmenu li.greenhover:hover
{
color: #333333;
background-color: #7dc242;
}
.coachnavmenu li.hover,
.coachnavmenu a:hover
{
color: #333333;
background-color: #7dc242;
text-decoration: underline;
}
.coachnavmenu ul ul
{
margin-top: -30px;
left: 99%;
}
.coachnavmenu span
{
display: block;
}
.coachnavmenu
{
float: left;
width: 100%;
color: #000;
}
.endmenu
{
clear: left;
}
Live html can be found here, but I think the problem is the CSS.
http://www.buffalolacrosse.com/test.cfm
I am having issues getting this menu to display correctly. It works in chrome or firefox, just not in IE. The menus are collapsed (the li padding doesnt work) and the alignment is all out of whack on vertical alignment. Your help is appreciated.
I think you need to specify the line height of the a elements in your menu.
I tried by setting the
#coachnavigation a
{
line-height:30px;
}
and it appears fine to me.
also add z-index to your menu, so the dropdown wont appear behind some elements.
div#navwrapper {
z-index:999;
}
I can't put my navigation menu to the right of screen. I used a lot of CSS but so it's a bit hard to find where is my mistake.
This is my html code:
<div id="main-container">
<div id="content">
<div id="header">
<ul id="nav">
<li >Nav 1</li>
<li>Nav 2</li>
<li class="selected">Nav 3</li>
<li>Nav 4</li>
</ul>
</div>
<div id="pictures">
</div>
</div>
This is the CSS i have trouble with:
#main-container {
}
#content {
background-color: #FFAA00;
background: url(images/table-surface-2-resized.jpg) repeat-x #000000;
width: 800px;
height: 600px;
border-radius: 5px;
}
#header {
background-color: #FFD200;
width: 800px;
height: 26px;
}
#pictures {
background-color: #A64D00;
width: 760px;
height: 540px;
border: 2px solid white;
border-radius: 15px;
margin-left: auto;
margin-right: auto;
margin-top: 14px;
}
/* TABS WITH ROUND, OUT BORDERS */
#nav {
text-align: center;
list-style: none;
margin: 0;
padding: 0;
line-height: 24px;
height: 26px;
overflow: hidden;
font-size: 12px;
font-family: verdana;
position: relative;
}
#nav li {
border: 1px solid #AAA;
background: #D1D1D1;
background: -o-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -ms-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -moz-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -webkit-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
display: inline-block;
position: relative;
z-index: 0;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 #FFF;
text-shadow: 0 1px #FFF;
margin: 0 -5px;
padding: 0 20px;
}
#nav li.selected {
background: #FFF;
color: #333;
z-index: 2;
border-bottom-color: #FFF;
}
#nav:before {
position: absolute;
content: " ";
width: 100%;
bottom: 0;
left: 0;
border-bottom: 1px solid #AAA;
z-index: 1;
}
#nav li:before,
#nav li:after {
border: 1px solid #AAA;
position: absolute;
bottom: -1px;
width: 5px;
height: 5px;
content: " ";
}
#nav li:before {
left: -6px;
border-bottom-right-radius: 6px;
border-width: 0 1px 1px 0;
box-shadow: 2px 2px 0 #D1D1D1;
}
#nav li:after {
right: -6px;
border-bottom-left-radius: 6px;
border-width: 0 0 1px 1px;
box-shadow: -2px 2px 0 #D1D1D1;
}
#nav li.selected:before {
box-shadow: 2px 2px 0 #FFF;
}
#nav li.selected:after {
box-shadow: -2px 2px 0 #FFF;
}
#nav a {
color: black;
text-decoration: none;
}
/* END TABS WITH ROUND, OUT BORDERS */
try out this css (addition)
#nav {
padding: 0 10px;
float:right;
}
here is working link
Fixed: http://dabblet.com/gist/3435951
Float #nav to the right, give it a right margin, remove overflow: hidden from it and add it on the #header.