Ive created a box using div class. but Ive been trying to space the row and columnsiV
Ive tried some padding-left and right both it doesnt seem to be working.
<div class="body">
<ul class="box">
<li> Maths </li>
<li> English </li>
<li> Chemistry </li>
<li> Commerce </li>
<li> Computer </li>
<li> Biology </li>
</ul>
</div>
</section>
Is there a reason you aren't just using margin? Specifically,
li {
margin: 10px;
margin-left: 30px; // if you want a different margin on the left
}
If this is not what you're looking for then please elaborate on your question.
li {
margin:10px;
margin-left:30px;
}
<div class="body">
<ul class="box">
<li> Maths </li>
<li> English </li>
<li> Chemistry </li>
<li> Commerce </li>
<li> Computer </li>
<li> Biology </li>
</ul>
</div>
To add padding between the rows, you need to add it to list elements.
Target these by using ".box li" in your CSS
You can use this code
.body .box {
margin: 0;
padding: 0;
}
.body .box li {
margin: 0;
padding: 0;
list-style-type: none;
}
.body .box li a {
margin: 0;
padding: 0 15px;
font-size: 18px;
font-weight: 400;
color: #337ab7;
line-height: 36px;
text-decoration: none;
}
.body .box li:hover a {
color: red;
}
<div class="body">
<ul class="box">
<li>Maths</li>
<li>English</li>
<li>Chemistry</li>
<li> Commerce </li>
<li>Computer</li>
<li>Biology</li>
</ul>
</div>
Related
I've the following menu struckture, but I can't make the last part act as I want.
When you hover over a menu item it shows the children, that part is fine. But when i hover, i would like the "blue" menu to have the same width as the entire red, and the blue text show me fixed to start from the left.'
Can anyone help me going, been trying to create this for an hour now.
thanks
ul.nav {
list-style: none;
}
ul.nav>li {
float: left;
}
ul.nav>li>a {
color: white;
padding:20px;
background-color: red;
}
ul.nav>li>ul {
list-style: none;
display: none;
background-color: blue;
margin-top: 20px;
}
ul.nav>li>ul>li>{
display:block;
}
ul.nav>li>ul>li>a {
color: white;
}
ul.nav>li>a:hover~ul {
display: block
}
<ul class="nav">
<li>
Menu 1.0
<ul>
<li>
Menu 1.1
</li>
<li>
Menu 1.2
</li>
<li>
Menu 1.3
</li>
</ul>
</li>
<li>
Menu 2.0
<ul>
<li>
Menu 2.1
</li>
<li>
Menu 2.2
</li>
<li>
Menu 2.3
</li>
</ul>
</li>
<li>
Menu 3.0
<ul>
<li>
Menu 3.1
</li>
<li>
Menu 3.2
</li>
<li>
Menu 3.3
</li>
</ul>
</li>
</ul>
Please try this. I have given position:relative to ul.nav and position:absolute; to ul.nav > li > ul submenu. and I have added html tag <div class="clear"></div> to clear div beacause ul have float:left property. and also add some other css please check in code.
ul.nav {
float: left;
list-style: none;
padding: 0;
position: relative;
}
ul.nav>li {
float: left;
}
ul.nav>li>a {
color: white;
padding:20px;
background-color: red;
display: block;
}
ul.nav > li > ul {
background-color: blue;
display: none;
left: 0;
list-style:none;
padding: 0;
position: absolute;
right: 0;
top: 100%;
width: 100%;
}
ul.nav>li>ul>li>{
display:block;
}
ul.nav>li>ul>li>a {
color: white;
}
ul.nav>li>a:hover~ul {
display: block
}
.clear{
clear:both;
}
<ul class="nav">
<li>
Menu 1.0
<ul>
<li>
Menu 1.1
</li>
<li>
Menu 1.2
</li>
<li>
Menu 1.3
</li>
</ul>
</li>
<li>
Menu 2.0
<ul>
<li>
Menu 2.1
</li>
<li>
Menu 2.2
</li>
<li>
Menu 2.3
</li>
</ul>
</li>
<li>
Menu 3.0
<ul>
<li>
Menu 3.1
</li>
<li>
Menu 3.2
</li>
<li>
Menu 3.3
</li>
</ul>
</li>
</ul>
<div class="clear"></div>
I think this is what you are looking for, i removed the padding in the submeny ul and added padding to a
ul.nav {
list-style: none;
display: inline-block;
padding: 0;
background: #00f;
}
ul.nav>li {
float: left;
}
ul.nav>li>a {
color: white;
padding:20px;
background-color: red;
}
ul.nav>li>ul {
list-style: none;
display: none;
background-color: blue;
margin-top: 20px;
}
ul.nav>li>ul>li>{
display:block;
}
ul.nav>li>ul>li>a {
color: white;
padding: 20px;
display: inline-block;
}
ul.nav>li:hover ul {
display: block;
padding: 0;
}
<ul class="nav">
<li>
Menu 1.0
<ul>
<li>
Menu 1.1
</li>
<li>
Menu 1.2
</li>
<li>
Menu 1.3
</li>
</ul>
</li>
<li>
Menu 2.0
<ul>
<li>
Menu 2.1
</li>
<li>
Menu 2.2
</li>
<li>
Menu 2.3
</li>
</ul>
</li>
<li>
Menu 3.0
<ul>
<li>
Menu 3.1
</li>
<li>
Menu 3.2
</li>
<li>
Menu 3.3
</li>
</ul>
</li>
</ul>
I am creating a menu using an unordered list that mixes list items of different sizes, some are half the height and width of others. They all float left. What I'm getting is this:
If I add clear:left to the third small item I get this:
What I want is for the second and fourth (or third and forth) small items to float below the other two, like this:
Is there a way to do this with css? The menu is created dynamically so forcing a particular position won't work, it needs to be able to flow into the proper position.
Would having multiple <ul/> work for you ? If so, the following Codepen would work : https://codepen.io/anon/pen/qPaVar
Same code as an embedded code snippet :
ul {
list-style : none;
padding: 0;
margin: 0;
text-align: center
}
li {
margin: 0
}
li.left {
float: left
}
div.small {
background-color: blue;
width: 20px;
height: 20px
}
div.large {
background-color: yellow;
width: 40px;
height: 40px;
}
<ul>
<li class="left">
<div class="large">A</div>
</li>
<li class="left">
<ul>
<li class="left">
<div class="small">1</div>
</li>
<li class="left">
<div class="small">2</div>
</li>
</ul>
<ul>
<li class="left">
<div class="small">3</div>
</li>
<li class="left">
<div class="small">4</div>
</li>
</ul>
</li>
<li class="left">
<div class="large">B</div>
</li>
</ul>
Hope this helps!
Try the grid-auto-flow: dense
https://developer.mozilla.org/ru/docs/Web/CSS/grid-auto-flow
try this
.main li {
display: inline-block;
vertical-align: middle !important;
width: 200px;
height: 200px;
border: 1px solid;
}
.inner-div li {
width: 99px;
height: 89px;
display: inline-block;
list-style: none;
padding: 0;
margin: 0;
float: left;
text-align: center;
}
ul.inner-div {
list-style: none;
padding: 0;
}
<div class="container">
<ul class="main">
<li>div 1</li>
<li>div 2
<ul class="inner-div">
<li>div 21</li>
<li>div 21</li>
<li>div 21</li>
<li>div 21</li>
</ul>
</li>
<li>div 3</li>
</ul>
</div>
I face a problem setting custom font-size in css document. Here's my problem. I use nav tag of html5. Where do I have to place the font-size attribute?
Here's part of my codeQ
Part of html code:
<div id="nav">
<nav>
<ul>
<li>
ΑΡΧΙΚΗ
</li>
<li>
ΥΠΗΡΕΣΙΕΣ
</li>
<li>
ΒΙΟΓΡΑΦΙΚΟ
</li>
<li>
ΕΠΙΚΟΙΝΩΝΙΑ
</li>
</ul>
</nav>
</div>
Part of my css code:
#nav {
width: 30%;
margin:0 auto;
}
nav>ul {
list-style: none;
}
nav>ul>li {
display: inline;
}
nav>ul>li>a {
font-family: "Comfortaa Thin", Comfortaa;
color:#807f7f;
}
You can apply font-size to any container element including nav itself
nav {
font-size: 40px;
}
#nav {
width: 30%;
margin: 0 auto;
}
nav>ul {
list-style: none;
}
nav>ul>li {
display: inline;
}
nav>ul>li>a {
font-family: "Comfortaa Thin", Comfortaa;
color: #807f7f;
}
<div id="nav">
<nav>
<ul>
<li>
ΑΡΧΙΚΗ
</li>
<li>
ΥΠΗΡΕΣΙΕΣ
</li>
<li>
ΒΙΟΓΡΑΦΙΚΟ
</li>
<li>
ΕΠΙΚΟΙΝΩΝΙΑ
</li>
</ul>
</nav>
</div>
nav>ul>li>a {
font-family: "Comfortaa Thin", Comfortaa;
color:#807f7f;
font-size: /*write here*/;
}
I'm designing a website for a non-profit and I'm having issues creating a navigation in the footer exactly like the one seen here.
I've accomplished the top part but the bottom part that looks like ULs next to each other is giving me trouble! I've been playing with the html/css for hours but nothing came close to this look so asking here is my last resort. I will post the current code.
**Not saying i'm a pro but I am not new to HTML/CSS as I created my entire website from scratch w/HTML & CSS.
Thanks in advance for your help!
HTML:
<div id="footer2" class="bottomleft bottomright">
<ul>
<li>ABOUT</li>
<li>
Our Mission and Vision
</li>
<li>
Our People
</li>
<li>
Our Outreach and Programs
</li>
<li>
Our Community Partners
</li>
</ul>
<ul>
<li>
ABOUT
</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
<ul>
<li>ABOUT</li>
<li>
Our Mission and Vision
</li>
<li>
Our People
</li>
<li>
Our Outreach and Programs
</li>
<li>
Our Community Partners
</li>
</ul>
<ul>
<li>ABOUT</li>
<li>
Our Mission and Vision
</li>
<li>
Our People
</li>
<li>
Our Outreach and Programs
</li>
<li>
Our Community Partners
</li>
</ul>
</div>
<!--end footer2-->
<div id="footer3">
<br />Copyright © 2014 All rights reserved.
<br />
<br />RSCF is a nonprofit organization whose mission is to "empower an educational revolution throughout the South Los Angeles community and beyond..."
<br />
<br />
</div>
<!--end footer3-->
</div>
<!--end container-->
CSS
#footer2 {
background-color: #609;
width: 980px;
height: 200px;
clear: both;
display: block;
text-align: center;
color: #FFF;
font-size: small;
padding-top: 10px;
}
#footer2 ul {
text-align: left;
height: auto;
margin: 0px;
}
#footer2 ul li {
display:inline-table;
padding: 5px;
}
#footer2 ul li a {
text-decoration: none;
color: #FFF;
padding: 0px 8px 8px 8px;
}
#footer2 ul li a:hover {
text-decoration: underline;
font-weight:900;
}
The first thing that i did was remove the display: inline, i've replaced it with list-style none to reach the same visual effect like the site which you referred. Well, after that i've change all the ul's to float left, so each one will be rendered as you needed.
The new css:
#footer2 {
background-color: #609;
width: 980px;
height: 200px;
clear: both;
display: block;
text-align: center;
color: #FFF;
font-size: small;
padding-top: 10px;
}
#footer2 ul {
text-align: left;
height: auto;
margin: 0px;
float: left;
}
#footer2 ul li {
list-style: none;
padding: 5px;
}
#footer2 ul li a {
text-decoration: none;
color: #FFF;
padding: 0px 8px 8px 8px;
}
#footer2 ul li a:hover {
text-decoration: underline;
font-weight:900;
}
I created a fiddle to help you figure out the result: http://jsfiddle.net/5ms8up9w/
This is a little closer. I added a few divs and turned your id's into classes.
HTML
<div id="footer">
<div class="footer2 bottomleft bottomright">
<ul>
<li>ABOUT</li>
<li>Our Mission and Vision
</li>
<li>Our People
</li>
<li>Our Outreach and Programs
</li>
<li>Our Community Partners
</li>
</ul>
</div>
<div class="footer2">
<ul>
<li>ABOUT</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
</div>
<div class="footer2">
<ul>
<li>ABOUT</li>
<li>Our Mission and Vision
</li>
<li>Our People
</li>
<li>Our Outreach and Programs
</li>
<li>Our Community Partners
</li>
</ul>
</div>
<div class="footer2">
<ul>
<li>ABOUT</li>
<li>Our Mission and Vision
</li>
<li>Our People
</li>
<li>Our Outreach and Programs
</li>
<li>Our Community Partners
</li>
</ul>
</div>
<!--end footer2-->
<div id="footer3">
<br />Copyright © 2014 All rights reserved.
<br />
<br />RSCF is a nonprofit organization whose mission is to "empower an educational revolution throughout the South Los Angeles community and beyond..."
<br />
<br />
</div>
<!--end footer3-->
</div>
<!--end container-->
CSS
#footer{width:100%;background-color:red;}
.footer2 {
background-color: #609;
width: 25%;
height: 200px;
float:left;
text-align: center;
color: #FFF;
font-size: small;
padding-top: 10px;
}
.footer2 ul {
text-align: left;
height: auto;
margin: 0px;
}
.footer2 ul li {
list-style:none;
padding: 5px;
}
.footer2 ul li a {
text-decoration: none;
color: #FFF;
padding: 0px 8px 8px 8px;
}
.footer2 ul li a:hover {
text-decoration: underline;
font-weight:900;
}
Fiddle: http://jsfiddle.net/383vdv3z/
I want to create a drop down menu view based on the following HTML / CSS :
<!DOCTYPE html>
<html>
<head>
<style>
html * {
margin: 0;
padding: 0;
}
body {
color: #FFF;
}
#panel, #content {
position: absolute;
top: 0;
bottom: 0;
}
#panel {
left: 0;
width: 750px;
background: #333;
z-index: 100;
padding-top: 200px;
padding-left: 250px;
}
#content {
background: #000;
left: 250px;
right: 0px;
}
#panel > nav {
margin-bottom: 100px;
}
.Dropdown {
position: relative; /* Has to be set, can be overriden */
}
.Dropdown > ul {
position: absolute;
display: none;
list-style-type: none;
}
.Dropdown:hover > ul {
display: block;
}
.Dropdown > ul, /* On the right by default */
.Dropdown.Right > ul { /* Deploys on the right side of the label */
top: 0;
left: 100%;
}
.Dropdown.Bottom > ul { /* Deploys below the label */
top: 100%;
left: 0;
}
</style>
</head>
<body>
<div id="panel">
<nav class="Dropdown Right" style="width: 200px;"><!-- so it can appear on jsfiddle -->
<div class="Label Parent">Label</div>
<ul>
<li>
<div class="Label">Entry</div>
</li>
<li>
<div class="Label">Entry</div>
</li>
<li>
<div class="Label">Entry</div>
</li>
<li>
<nav class="Dropdown Right">
<div class="Label Parent">Label</div>
<ul>
<li>
<div class="Label">Entry</div>
</li>
<li>
<nav class="Dropdown Right">
<div class="Label Parent">Label</div>
<ul>
<li>
<div class="Label">Entry</div>
</li>
<li>
<div class="Label">Entry</div>
</li>
<li>
<div class="Label">Entry</div>
</li>
<li>
<div class="Label">Entry</div>
</li>
</ul>
</nav>
</li>
<li>
<div class="Label">Entry</div>
</li>
<li>
<div class="Label">Entry</div>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
<div id="content">
</div>
</body>
I would like a developper to be able to extend this drop down CSS to add, for example, a transition between 0 and 1 opacity.
Actually it is not possible with this code because the property display conflicts with the transition one. Adding opacity 0 on the non-hover and opacity 1 on the hover will not work because of that display property.
I've read somewhere on this web site that i could use height 0 and height auto instead of display none and display block (respectivly) but it didn't work either.
Any ideas about how to add transitions please ?
Thanks for your help !