Cannot separate the item un-ordered list and button - html

I don't know how to describe this problem. I'm using three styling frameworks Bootstrap, Semantic, and Materialize CSS. I've created an unordered list after that there is a button when I use the br tag to separate them separation works but the gap doesn't fill with the body background color so I used margin but still, the gap is not filling with body color.
You can see this problem in this
HTML code
<section>
<div class="container dashboard ">
<div class="row">
<aside class="col-sm-3">
<ul class="list-group text-center">
<a class="list-group-item active" href="#">Dashboard</a>
<a class="list-group-item" href="#">All Posts</a>
<a class="list-group-item" href="#">Create/Edit Posts</a>
</ul>
<a class="btn btn-light btn-block" href="#"> <i class="fa fa-power-off"></i> <span class="text">Log out</span> </a>
</aside>
</div>
</div>
</section>
CSS
.dashboard{
margin-top: 100px;
margin-bottom: 100px;
padding: 30px 0px;
}
.dashboard .col-sm-3{
border-bottom: none;
border-radius: 5px;
height: fit-content;
padding-left: 0;
padding-right: 0;
background: #fff;
}
.dashboard .col-sm-3 ul a{
text-decoration: none;
font-weight: 500;
}
.dashboard .col-sm-3 .btn {
margin-top: 50px;
}
.btn-light {
background-color: #fff;
border-color: #e4e4e4;
text-align: center;
}
.btn-light span{
text-transform: none;
font-weight: 500;
}

You can check this question this thing will help you link
Actually, this question helps me too I've also faced a similar situation.
I will make this more simple I think this work you can try this
br {
content: "A" !important;
background: #fafafa !important;
display: block !important;
width: 100% !important;
height: 30px !important;
}

Related

How to keep icons aligned strictly inside div?

I am making a sidebar and am new to css. I created a div which represents a closed sidebar. It is supposed to only show the icons. Unfortunately the icons come in a misaligned manner inside the div based on their size. How do I fix this?
.sidenav {
height: 492px;
width: 300px;
background-color: #db3d44;
}
.data-icon {
font-size: 45px;
color: black;
opacity: 0.5;
float: left;
margin-left: 9px;
margin-top: 5px;
margin-bottom: 10px;
}
.hamburger {
background-color: transparent;
border-color: transparent;
color: white;
margin-left: 10px;
margin-top: 4px;
font-size: 25px;
}
.hamburger:hover {
color: black;
}
.sidenav-closed {
width: 65px;
float: left;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="sidenav-closed sidenav">
<button class="hamburger data-disappear">☰</button>
<div class="icons-only">
<div class="data-icon">
<i class="fa fa-home"></i>
</div>
<div class="data-icon">
<i class="fa fa-car"></i>
</div>
<div class="data-icon">
<i class="fa fa-home"></i>
</div>
</div>
</div>
The car icon is misaligned here. What's the solution?
You could try to align all the icons to the center so your .data-icon class could look like this:
.data-icon {
font-size: 45px;
color: black;
opacity: 0.5;
display: block;
width: 100%;
text-align: center;
}
Your div elements doesn't have set width and height in CSS - so the icons are strictly aligned inside them.
If you want to vertically center them and learn something new use flexbox:
.icons-only {
display: flex;
flex-direction: column;
align-items: center;
}
and
.data-icon {
...
margin-left:0
}
Your car icon is also a little bit bigger than house - you can a little change it size by add new class to it or use this:
.data-icon:nth-child(2) {
font-size: 40px;
}
This CSS code will take second (=2) element with class .data-icon and set different font size for it
The icons are inline elements so they will be left aligned by default. Add in that the icons are not that same size (this is normal), you get an uneven alignment.
To remedy this, add text-align: center to .icons-only.
Note: Given the layout in the example, it does not appear necessary to float .data-icon to the left.
.sidenav {
height: 492px;
width: 300px;
background-color: #db3d44;
}
.icons-only {
text-align: center;
}
.data-icon {
color: rgba( 0, 0, 0, 0.5 );
font-size: 45px;
}
.hamburger {
background-color: transparent;
border-color: transparent;
color: white;
margin-left: 10px;
margin-top: 4px;
font-size: 25px;
}
.hamburger:hover {
color: black;
}
.sidenav-closed {
width: 65px;
float: left;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="sidenav-closed sidenav">
<button class="hamburger data-disappear">☰</button>
<div class="icons-only">
<div class="data-icon">
<i class="fa fa-home"></i>
</div>
<div class="data-icon">
<i class="fa fa-car"></i>
</div>
<div class="data-icon">
<i class="fa fa-home"></i>
</div>
</div>
</div>

Footer not aligning to the bottom of the page

When I added the footer to my website it was on the bottom of all the pages except just one. On that specific page my footer behaves like there's no content at all, maybe it overlaps somehow with the main content of the page, but I can't figure out how to resolve that issue.
Here's the html of my footer:
<footer class="bottom-footer text-center">
<hr>
<div class="row">
<div class="col-lg-12">
<ul class="nav nav-justified">
<li>
<div class="container">
<p class="navbar-text pull-left brand-name">
Symphony © 2015
</p>
<a href="http://youtu.be/zJahlKPCL9g" class="navbar-btn btn-danger btn pull-right">
<span class="glyphicon glyphicon-envelope"></span>  Subscribe to our Newsletter</a>
</div>
</li>
</ul>
</div>
</div>
</footer>
And here's the css:
footer.bottom-footer {
position: relative;
clear: both !important;
z-index: 999999 !important;
bottom: 0 !important;
width: 100% !important;
margin-top: 20px !important;
margin-bottom: 20px !important;
}
footer.bottom-footer hr {
margin-top: 150px !important;
}
footer.bottom-footer .brand-name {
font-family: 'Bitter', serif;
}
as you can see, it's pretty simple. But for some reason it behaves weird on one particular page of my website. Here's the codepen with the code and here's the full page view to make it easier to understand what my problem is.
Could you please help me with resolving that weird issue?
please try this css...
footer.bottom-footer {
position: relative;
clear: both !important;
z-index: 999999 !important;
bottom: 0 !important;
width: 100% !important;
margin-top: 20px !important;
margin-bottom: 20px !important;
}
footer.bottom-footer hr {
margin-top: 150px !important;
}
footer.bottom-footer .brand-name {
font-family: 'Bitter', serif;
}
a {
background-color: transparent;
padding-left: 316px;
}

Rearrange buttons in a horizontal line

I am designing a website, and have these menu buttons which will act as like a banner near the top of the page for navigation.
However, at the moment on the website the buttons are in a vertical line. How do i make them horizontal?
here is the button:
button1 {
display: block;
width: 175px;
box-sizing: border-box;
margin: 0.5rem auto;
padding: 0.75rem;
font-size: 1.5rem;
text-align: center;
color: white;
border: solid #ffffff 2px;
background: #8ec8ea;
border-radius: 0.5rem;
outline: none;
cursor: pointer;
}
and my html where ive made the buttons..
<t><button1>Home</button1></t>
<t><button1>Facilities</button1></t>
<t><button1>Facilities</button1></t>
<t><button1>Donate</button1></t>
<t><button1>News</button1></t>
<t><button1>Testimonials</button1></t>
<t><button1>Contact us</button1></t>
Also, if there is better practice of doing this - let me know!
Just change your display: block; to display: inline-block; in your button1 css
JSFiddle: http://jsfiddle.net/ghorg12110/8wzgddhg/1/
And if you want a HTML W3C valid :
HTML:
<div class="t">
<a href="http://tv005382.webs.sse.reading.ac.uk/Lithium/3.-Lithium/app/" class="button1">
Home
</a>
</div>
<div class="t">
<a href="http://tv005382.webs.sse.reading.ac.uk/Lithium/3.-Lithium/app/Facilities.html" class="button1">
Facilities
</a>
</div>
<div class="t">
<a href="http://tv005382.webs.sse.reading.ac.uk/Lithium/3.-Lithium/app/Facilities.html" class="button1">
Facilities
</a>
</div>
<div class="t">
<a href="http://tv005382.webs.sse.reading.ac.uk/Lithium/3.-Lithium/app/Donate.html" class="button1">
Donate
</a>
</div>
<div class="t">
<a href="http://tv005382.webs.sse.reading.ac.uk/Lithium/3.-Lithium/app/News.html" class="button1">
News
</a>
</div>
<div class="t">
<a href="http://tv005382.webs.sse.reading.ac.uk/Lithium/3.-Lithium/app/Testimonials.html" class="button1">
Testimonials
</a>
</div>
<div class="t">
<a href="http://tv005382.webs.sse.reading.ac.uk/Lithium/3.-Lithium/app/Contact.html" class="button1">
Contact us
</a>
</div>
CSS:
.button1 {
width: 175px;
box-sizing: border-box;
margin: 0.5rem auto;
padding: 0.75rem;
font-size: 1.5rem;
text-align: center;
color: white;
border: solid #ffffff 2px;
background: #8ec8ea;
border-radius: 0.5rem;
outline: none;
cursor: pointer;
display: inline-block;
text-decoration: none;
}
.t {
display: inline-block;
}
JSFiddle : http://jsfiddle.net/ghorg12110/8wzgddhg/2/

HTML, CSS: Append inline-element to the right of a centered inline-element

(The title might sound stupid but I don't know how to put it more sophisticated.)
As you can see in the follwing screenshots, I have 3 stacked divs.
<div class="col-xs-3">
<div class="center-horizontal-inline">
<a class="upvote" href="#" data-id="iZheLNnewWtMhPTQd">
</div>
<div class="score">
115
<span class="badge score-diff vertical-align"> +5 </span>
</div>
<div class="center-horizontal-inline">
</div>
The one in the middle contains the number (115). The other two the vote-arrows. For the one containing the number, I want to add a "badge" (in bootstrap context) right next to the number, let's say to the right. You can see my attempt shining through the colored overlay.
The goal is to leave the number centered respectively to the arrow-icons, while placing the badge with an offset (or "right next to") respectively to the number.
My attempt was to set a float: right; for the badge, but as you can see, the number has an offset now. When I try position: absolute; on the badge, there is no offset (as wanted), but I can't get the badge right next to the number, I can only attach it to the right border because I don't have the number as positioning-reference anymore.
Hope my explanation was clear enough. I also didn't know how to search for that problem...
EDIT 1:
As I want it to look like (positioning-wise):
Here we go, using relative and absolute positions together:
DEMO: http://jsfiddle.net/1qbo7uwn/
HTML
<div class="score">
<span class="score-wrap">
<span class="score-main">123</span>
<span class="score-diff">8</span>
</span>
</div>
CSS
.score {
width: 80px;
border: 2px solid blue;
padding: 10px 0;
text-align: center;
}
.score-wrap {
display: inline-block;
position: relative;
}
.score-main {
border: 2px solid green;
}
.score-diff {
position: absolute;
border: 2px solid red;
left: 100%;
top: -2px;
}
Added some span tags in the HTML.
EDIT: vertical align of everything, by setting line height.
http://jsfiddle.net/1qbo7uwn/1/
As you said you are okay with HTML modification. Here's my attempt:
Demo Fiddle
HTML
<div class="wrap">
<div class="vote up">
<i class="fa fa-angle-up"></i>
</div>
<div class="stat">
<span class="score">115
<span class="badge">+5</span>
</span>
</div>
<div class="vote inactive">
<i class="fa fa-angle-down"></i>
</div>
</div>
CSS
.wrap{
margin: 100px;
text-align:center;
}
.vote{
font-size:36px;
}
.up{
color:green;
}
.down{
color:red;
}
.inactive{
color:gray;
}
.score{
position: relative;
display:block;
padding: 5px 0;
}
.badge{
background: #eee;
padding:5px 10px;
border-radius: 30px;
position: absolute;
top:0;
margin-left:10px;
}
Try
Demo: http://jsfiddle.net/tamilcselvan/rjv1xxo2/1/
.center-horizontal-inline {
font-size: 2em;
text-align: center;
}
.score {
text-align: center;
}
.score:after {
content:attr(data-badge);
position: absolute;
margin-left: .4em;
font-size: x-small;
min-width: 10px;
padding: 3px 7px;
font-size: 12px;
font-weight: 700;
line-height: 1;
color: #FFF;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
background-color: #777;
border-radius: 10px;
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-xs-3">
<div class="center-horizontal-inline vote"> <i class="glyphicon glyphicon-chevron-up"></i>
</div>
<div class="score" data-badge="+5">115</div>
<div class="center-horizontal-inline"> <i class="glyphicon glyphicon-chevron-down"></i>
</div>
</div>

How can I align these HTML components?

I've got 2 views, one for logged in and one for logged out. The logged out view I think is OK:
When logged in, the components do not align properly, as can be seen the user picture displays too far to the left:
Can you tell me what I need to do to achieve more aligned graphics? I think the user picture and the logo should be aligned the same. The code is:
<div id="header">
<a id="logo" href="/" name="logo"><img src="/_/img/kool_business.png" height="80"
title="Koolbusiness.com" alt="Koolbusiness.com" /></a>
<div id="page_name" class="ctext1">
<div class="ctext2">
<div class="ctext3">
For sale
</div>
</div>
</div>
<div id="line"></div>
</div>
<div id="container_main">
<div class="navbar">
<div style="float:left; margin-top:6px;">
<img src=
"https://graph.facebook.com/327400016/picture?type=small" /><a href=
"/user/niklas-rosencrantz">Niklas Rosencrantz</a><span style=
"color:#99ccff"> | </span>Home<span style=
"color:#99ccff"> | </span> <a href="/ai">Insert
ad</a><span style="color:#99ccff"> | </span> <a href=
"/tamil_nadu">Search for ads</a><span style=
"color:#99ccff"> | </span> <a href=
"/li?t=w">Wanted</a><span style="color:#99ccff"> | </span>
Log out
</div>
</div>
</div>
Should I just remove the style:"float:left; margin-top:6px or what do you think I should do the present the layout smoother? The CSS for my page is
#header {
margin-left: 26px;
margin-top: 16px;
width: 790px;
height: 70px;
}
#logo,
#page_name {
float: left;
height: 50px;
}
#page_name {
font-size: 14px;
vertical-align: middle;
width: 250px;
}
#logo { margin-right: 26px }
.navbar {
margin: 5px 0 10px -7px;
overflow: hidden;
}
.navbar a,
.navbar a:visited,
.navbar a:link {
margin-top: 5px;
margin-left: 8px;
margin-right: 8px;
font-size: 14px;
color: #336699;
text-decoration: none;
}
.navbar a:hover { text-decoration: none }
.navbar a:active { text-decoration: underline }
Thanks in advance for any answer or comment
Put the image inside the anchor tag for the name rather than outside it.
You have margin-left: -7px on .nav and then counter-act it with margin-left: 8px on the anchor tags inside the nav div, but never do so with the img.
Can you get rid of the -7px left margin in .nav or do you have it there for another reason?