I've been trying to get this scrollbar code to work on Blogger, but haven't been able to figure out how to. Can someone see if they are able to figure out what the issue is, and how to resolve it.
Same Code, Both look and act different,
Jsfiddle:
https://jsfiddle.net/xuc92tt3/
Screenshot
vs.
Blogger:
https://debugscroll.blogspot.com/
Screenshot
Also, there shouldn't be a horizontal line below the div blocks either.
<style>
.test {
width: 266px;
height: 175px;
padding: 0;
margin: 0;
overflow: auto;
background: #000;
list-style: none;
text-align: left;
}
.test li {
padding-bottom: 20px;
}
.test li:last-of-type {
padding: 0;
}
h2 {
margin: 0;
line-height: 1;
font-size: 25px;
color: #00f;
}
.test a:link {
width: 243px;
height: 20px;
display: block;
background: green;
}
.test a:visited {
background: #f00;
color: #000000;
}
.test a:hover {
color: #000;
}
</style>
<ul class="test ">
<li>
<h2>Text</h2>
</li>
<li>
<h2>Text</h2>
</li>
<li>
<h2>Text</h2>
</li>
<li>
<h2>Text</h2>
</li>
<li>
<h2>Text</h2>
</li>
<li>
<h2>Text</h2>
</li>
<li>
<h2>Text</h2>
</li>
<li>
<h2>Text</h2>
</li>
<li>
<h2>Text</h2>
</li>
<li>
<h2>Text</h2>
</li>
<li>
<h2>Text</h2>
</li>
<li>
<h2>Text</h2>
</li>
<li>
<h2>Text</h2>
</li>
<li>
<h2>Text</h2>
</li>
</ul>
Looks like in the blogspot example your <li> elements are inheriting a 15px padding from a global style declared in the page head section.
Try overriding that with the following css:
.test li {
padding-bottom: 20px;
padding-left: 0;
padding-right: 0;
}
Add this CSS code
.main-inner .widget ul li {
padding: 0;
border-top: 0;
border-bottom: 0;
margin-bottom: 20px;
}
.main-inner .widget h2 {
margin: 0;
padding: 0;
}
Related
Here's my HTML:
<body>
<nav class="navbar">
<span class="navbar-toggle" id="js-navbar-toggle">
<i class="fas fa-bars"></i>
</span>
logo
<ul class="main-nav" id="js-menu">
<li>
Home
</li>
<li>
Products
</li>
<li>
About Us
</li>
<li>
Contact Us
</li>
<li>
Blog
</li>
</ul>
</nav>
</body>
Here's my CSS:
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
body {
font-family: "Josefin Sans", sans-serif;
}
.navbar {
font-size: 18px;
padding-bottom: 10px;
}
.main-nav {
list-style-type: none;
display: none;
}
.nav-links,
.logo {
text-decoration: none;
color: black;
}
.main-nav li {
text-align: center;
margin: 15px auto;
}
.logo {
display: inline-block;
font-size: 22px;
margin-top: 10px;
margin-left: 20px;
}
.navbar-toggle {
position: absolute;
top: 10px;
right: 20px;
cursor: pointer;
color: rgba(255, 255, 255, 0.8);
font-size: 24px;
}
.active {
display: block;
}
And this is the output I'm getting:
I'd like my output to be like this instead (ignore the spacing difference, just my screenshot, but have them split in the center like so):
What's the best way of doing this?
I'm thinking of creating another unorder list and moving it, but I don't know how to do that.
Make use of justify-content: space-between;.
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
ul {
list-style-type: none;
}
.nav-links, .logo {
text-decoration: none;
color: #000;
}
.navbar {padding: 20px;}
.navbar, ul {display: flex; flex-direction:row;}
ul li {padding: 0 5px;}
.wrapper {display:flex; justify-content: space-between; width:100%; }
<nav class="navbar">
logo
<div class="wrapper">
<ul class="main-nav" id="js-menu">
<li>
Home
</li>
<li>
Products
</li>
<li>
About Us
</li>
</ul>
<ul class="ul2">
<li>
Contact Us
</li>
<li>
Blog
</li>
</ul>
</div>
</nav>
I would like to place an image to the left of the text and keep it like that depending on the resolution of the window.
Here's what it looks like without an image: http://prntscr.com/fmky4f
This is what I would like it to look like after placing it. https://prnt.sc/fmkk0a
This is my code:
.xd {
font-size: 20px;
list-style: none;
margin: 0;
padding: 0;
text-align: center;
}
.xd li {
display: inline;
}
.xd a {
display: inline-block;
padding: 5px;
color: #080808;
}
.logo {
width: 10%;
height: auto;
float: left;
}
<div class="container">
<div id="container-fluid">
<ul class="xd">
<li>
Home
</li>
<li>
About Us
</li>
<li>
News
</li>
<li>
Gallery
</li>
<li>
Map
</li>
<li>
Contact Us
</li>
</ul>
</div>
Now I tried just simply putting in the image with the .logo class properties, but they don't seem to do the job as intended.
If you're going to use floats and widths for the logo, use that for the menu also.
.xd {
float: left;
width: 90%;
font-size: 20px;
list-style: none;
margin: 0;
padding: 0;
text-align: center;
}
.xd li {
display: inline;
}
.xd a {
display: inline-block;
padding: 5px;
color: #080808;
}
.logo {
width: 10%;
height: auto;
float: left;
}
<div class="container">
<div id="container-fluid">
<img class="logo" src="http://placehold.it/50x50">
<ul class="xd">
<li>
Home
</li>
<li>
About Us
</li>
<li>
News
</li>
<li>
Gallery
</li>
<li>
Map
</li>
<li>
Contact Us
</li>
</ul>
</div>
You could also use flexbox. Perhaps something like this:
header,
ul {
display: flex;
}
header img {
display: block;
max-width: 100%;
height: auto;
}
header ul {
flex-grow: 1;
justify-content: center;
margin: 0;
padding: 0;
list-style: none;
font-size: 20px;
}
header a {
padding: 5px;
color: #080808;
}
<header>
<div>
<img src="http://placehold.it/50x50">
</div>
<ul>
<li>
Home
</li>
<li>
About Us
</li>
<li>
News
</li>
<li>
Gallery
</li>
<li>
Map
</li>
<li>
Contact Us
</li>
</ul>
</header>
You can use position: absolute; and the default settings on the image as shown below. (You can use top and left settings to move it away from the border/corner if you want)
This keeps the menu items centered in relation to the container.
.xd {
font-size: 20px;
list-style: none;
margin: 0;
padding: 0;
text-align: center;
}
.xd li {
display: inline;
}
.xd a {
display: inline-block;
padding: 5px;
color: #080808;
}
.logo {
width: 10%;
height: auto;
float: left;
}
#image1 {
position: absolute;
}
<div class="container">
<img src="http://placehold.it/80x50/fb4" id="image1">
<div id="container-fluid">
<ul class="xd">
<li>
Home
</li>
<li>
About Us
</li>
<li>
News
</li>
<li>
Gallery
</li>
<li>
Map
</li>
<li>
Contact Us
</li>
</ul>
</div>
I'm working on a navigation bar and it currently looks like this:
Now I want that the text floats to the right. So that the red space is on the left-side. But if try "float: right", it looks like this:
The red background disappeared. I used a extra div (columnsection) but in the best case scenario I want to get rid of it. I hope someone could help me.
* {
padding: 0px;
margin: 0px;
}
#navbar {
margin: auto;
width: 100%;
max-width: 1200px;
background-color: red;
color: white;
}
#navbar ul li {
display: inline-block;
background-color: blue;
margin: 0px;
}
#navbar ul {
float: right;
}
<div id="navbar">
<div id="columnsection">
<ul>
<li> Lorem </li>
<li> Lorem </li>
<li> Lorem </li>
<li> Lorem </li>
<li> Lorem </li>
</ul>
</div>
Instead of float:right use text-align:right
* {
padding: 0px;
margin: 0px;
}
#navbar {
margin: auto;
width: 100%;
max-width: 1200px;
background-color: red;
color: white;
}
#navbar ul li {
display: inline-block;
background-color: blue;
margin: 0px;
}
#navbar ul {
text-align: right;
}
<div id="navbar">
<div id="columnsection">
<ul>
<li> Lorem </li>
<li> Lorem </li>
<li> Lorem </li>
<li> Lorem </li>
<li> Lorem </li>
</ul>
</div>
</div>
Hello I'm a beginner and got a problem with my navigationbar in HTML. I've tried a lot but they are still unclickable...
Is there a mistake in my HTML?
<header>
<nav display: inline;>
<ul>
<li>
<navi><img src="images/header_logo.png" alt="Logo" href="index.html" width="40%" height="40%" /></navi>
</li>
<li>
<navi>
<z class="active" href="index.html">Startseite</z>
</navi>
</li>
<li>
<navi>
<z href="produkte.html">Produkte</z>
</navi>
</li>
<li>
<navi>
<z href="about.html">Über uns</z>
</navi>
</li>
<li>
<navi>
<z href="agb.html">AGB</z>
</navi>
</li>
</ul>
</nav>
or is the mistake in my CSS? It's probably not the best way to style it but it looks good in my eyes. However I cant click any links...
body {
margin: 0px;
padding: 0px;
}
img {
max-width: 100%;
}
ul {
margin: 0px;
list-style: none;
padding: 0px;
overflow: hidden;
background-color: burlywood;
}
li navi {
float: left;
display: block;
text-align: center;
padding: 14px 16px;
}
li navi z {
float: left;
display: block;
text-align: center;
padding: 14px 30px;
margin-top: 40px;
color: white;
border: 2px solid white;
}
.active {
background-color: #deae6f;
}
li z:hover:not(.active) {
background-color: #deb27a;
}
Thanks for help
Here's the link for Your above Problem https://jsfiddle.net/kj0w9g76/
Reason:- for anchor tag we use 'a' not with 'z'
instead of navi tag we use nav tag as used in code below.
body {
margin: 0;
padding: 0;
}
img {
max-width: 100%;
}
ul {
margin: 0;
list-style: none;
padding: 0;
overflow: hidden;
background-color: burlywood;
position: relative;
z-index: 1;
}
li nav {
float: left;
display: block;
text-align: center;
padding: 14px 16px;
}
li nav z {
float: left;
display: block;
text-align: center;
padding: 14px 30px;
margin-top: 40px;
color: white;
border: 2px solid white;
}
.active {
background-color: #deae6f;
}
li a:hover:not(.active) {
background-color: #deb27a;
}
<header>
<nav style="display: inline;">
<ul>
<li>
<nav><a href="index.html" width="40%" height="40%" ><img src="images/header_logo.png" alt="Logo"/></a></navi>
</li>
<li>
<nav>
<a class="active" href="index.html">Startseite</a>
</nav>
</li>
<li>
<nav>
Produkte
</nav>
</li>
<li>
<nav>
Über uns
</nav>
</li>
<li>
<nav>
AGB
</nav>
</li>
</ul>
</nav>
</header>
You've a problem in your code, styles, anchors are not correct there is the correct code below.
* {
box-sizing: border-box;
}
body {
margin: 0px;
padding: 0px;
}
img {
max-width: 100%;
}
ul {
margin: 0px;
list-style: none;
padding: 0px;
overflow: hidden;
background-color: burlywood;
}
li nav {
float: left;
display: block;
text-align: center;
padding: 14px 16px;
}
li a {
float: left;
display: block;
text-align: center;
padding: 14px 30px;
margin-top: 40px;
color: white;
border: 2px solid white;
}
.active {
background-color: #deae6f;
}
li a:hover:not(.active) {
background-color: #deb27a;
}
<header>
<nav style="display: block;">
<ul>
<li>
<nav><img src="images/header_logo.png" alt="Logo" href="index.html" width="40%" height="40%" /></nav>
</li>
<li>
<nav>
<a class="active" href="index.html">Startseite</a>
</nav>
</li>
<li>
<nav>
Produkte
</nav>
</li>
<li>
<nav>
Über uns
</nav>
</li>
<li>
<nav>
AGB
</nav>
</li>
</ul>
</nav>
</header>
How do I align an ol so that it can look like this:
Justified
By simply "text-align: justify;" to the ol it looks like this:
Not justified actually!
Please and thank you :)
There is a similar answer that I used to create the leading dots in pure CSS. This is a CSS trick that puts dots behind everything, then covers up the dots behind the text using background: white;. If the background is a solid color, then this could work.
ol {
list-style: none;
max-width: 20em;
overflow-x: hidden;
padding: 0;
}
ol li:before {
content: "...................................................";
float: left;
letter-spacing: 0.25em;
white-space: nowrap;
width: 0;
}
ol span:first-child {
background: white;
padding-right: 0.33em;
}
ol span + span {
background: white;
float: right;
padding-left: 0.33em;
}
<ol>
<li>
<span>United States</span>
<span>86%</span>
</li>
<li>
<span>Canada</span>
<span>5%</span>
</li>
<li>
<span>UK</span>
<span>4%</span>
</li>
<li>
<span>Australia</span>
<span>3%</span>
</li>
<li>
<span>Germany</span>
<span>2%</span>
</li>
</ol>
As Paulie_D mentioned, you might want to consider using a simple table like this:
<table>
<tbody>
<tr>
<td>[Flag]</td>
<td>[Name]</td>
<td class="text-right">[Percentage]</td>
</tr>
</tbody>
</table>
And you should make sure your table width is set to 100% of the container in your CSS file:
table {
width: 100%;
}
.text-right {
text-align: right;
}
Flexbox version:
ul {
list-style-type: none;
margin: 0 auto;
width: 80%;
padding: 0;
}
.list {
display: flex;
}
.first {
margin-right: 0.5em;
color: #2B91AF;
flex: 1;
display: flex;
}
.price {
text-align: right;
flex: 0 0 4em;
}
.first:after {
content: '';
border-bottom: dotted 2px tomato;
flex: 1;
}
<ul>
<li class="list">
<i class='first'>Co-Pay:</i>
<i class="price">$150.00</i>
</li>
<li class="list">
<i class='first'>Pay:</i>
<i class="price"> $5.00</i>
</li>
<li class="list">
<i class='first'>Co-Pay: item</i>
<i class="price"> $15.00</i>
</li>
<li class="list">
<i class='first'>Co-Pay: great deal</i>
<i class="price"> $1.00</i>
</li>
</ul>