Icon over image + y axis positioning - html

I am trying to get my 5 Font Awesome Icons over my background image with a fixed position. That fixed position should allow me to scroll past it whitout any problem. I know that there is a way but i am not finding it.
My HTML:
<!--Kaffe abschnitt -->
<!--5 Icons-->
<ul>
<li><i class="fa fa-cog fa-5x"></i></li>
<li><i class="fa fa-rebel fa-5x"></i></li>
<li><i class="fa fa-empire fa-5x"></i></li>
<li><i class="fa fa-twitch fa-5x"></i> </li>
<li><i class="fa fa-steam fa-5x"></i> </li>
</ul>
<!--Ende 5 Icons-->
<!--Hintergrund-->
<img src="img/bild2.png" class="container-full">
<!--Ende Kaffe abschnitt -->
Background CSS:
.container-full {
margin: 0 auto;
width: 100%;
z-index: -999;
}
Icon CSS:
ul li {
list-style-type: none;
float: left;
}
ul li a span {
background: transparent;
color: #205D7A;
width: 240px;
height: 240px;
border-radius: 50%;
border: 2px solid;
text-align: center;
transition: all 0.2s ease-in-out;
z-index: 998;
}
ul li a span:hover {
opacity: .8;
}
I am not asking for a premade full code. Just the name of the actions or some short code snipeds.

I am trying to get my 5 Font Awesome Icons over my background image with a fixed position.
You don't want to use 'position:fixed' if you want to scroll past them.
Instead, use position:absolute.
absolute will position elements according to the first parent that has anything but "position:static", i suggest setting "position:relative" on the parent you want your elements to position them self according to.
If you want your "icons" to be along the right hand side of a div, then it would have looked like this
#myDiv{position:relative;} //the container
.myIcons{position:absolute; right:0} //a handy class on all your icons spans/i
.icon1{top:0px} //these are just unique classes per icon
.icon2{top:20px}
.icon3{top:40px}
Hope this gets you in the righth direction

Related

My goal is to have the icon be replaced by text when hovered. Issue im having is all the icons move to the left when an icon is hovered

I have a vertical side-bar containing icons using a column in flexbox. My goal is when an icon is hovered the icon is replaced by text, Example A house icon when hovered says Home. The problem i am having is when The text appears all the icons not being hovered move to the left. I would like for them to remain centered. Thank you for the help!
MY HTML.
<ul class="main-links">
<li><i class="fas fa-home"></i><b>Home</b></li>
<li><i class="fas fa-user"></i></li>
<li><i class="fas fa-book"></i></li>
<li><i class="fas fa-tools"></i></li>
<li><i class="fas fa-envelope"></i></li>
</ul>
My CSS.
.main-links li i{
color: white;
font-size: 20px;
padding-bottom: 40px;
background: #181818;
width: 22.5px;
height: 21px;
}
.main-links li :hover i{
display: none;
}
.main-links li b{
display: none;
}
.main-links li :hover b{
display: block;
}

How to make <a> tag take 100% height of <li> element

I am struggling to make my <a> take 100% height of <li> element and i want to do this because when i hover over <a> i want it to get background color and to change its color to white.
this is how it should look like
I have tried giving my <a> height:100%
but this is my result
on second picture i cut out the piece and zoomed it in so you guys can see better
i found one answer on other stack overflow thread where you would give <ul> display:table and give height:0 and then give <li> height:100% but it doesnt work for me.
PLEASE NOTE THAT IM USING BOOTSTRAP 4.0.0alpha and SASS(SCSS)
HTML
<div class="topContact hidden-md-down">
<div class="container">
<div class="row">
<ul class="contactInfo">
<li class="d-inline-block"><i class="far fa-envelope"></i>info#reen.com</li>
<li class="d-inline-block"><i class="fas fa-mobile-alt"></i>+00 (123) 456 78 90</li>
</ul>
<ul class="socialIcons ml-auto">
<li class="d-inline-block"><i class="fab fa-facebook-f"></i></li>
<li class="d-inline-block"><i class="fab fa-google-plus-g"></i></li>
<li class="d-inline-block"><i class="fab fa-twitter"></i></li>
<li class="d-inline-block"><i class="fab fa-pinterest-p"></i></li>
<li class="d-inline-block"><i class="fab fa-behance"></i></li>
<li class="d-inline-block"><i class="fab fa-dribbble"></i></li>
</ul>
</div>
</div>
</div>
SCSS
.topContact{
background-color: #f5f7fa;
border-bottom: 1px solid #e6e9ed;
ul{
padding:0px 15px 0px 15px;
margin:0;
}
a:hover{
background: indigo;
}
a{
height: 100%;
}
.contactInfo li,
.contactInfo a,
.socialIcons a{
font-size: 10pt;
color: #506a85;
}
.contactInfo a:hover{
text-decoration: none;
color: #00bc9c;
}
.contactInfo svg,{
margin-right: 8px;
}
.contactInfo li{
padding-right: 20px;
}
}
In order for a child element to assume 100% height of the parent element, the parent element must have its size set. Its not enough to give your <li> element a font size for its <a> child to extend its height to cover it. The <li> must inherit the height from its parent or have it defined. Also, your <a> element must be a block or inline-block element to accept height.
Try:
<style type="text/css">
ul#socialIcons, ul#socialIcons>li { margin:0px; padding:0px; list-style:none; }
ul#socialIcons>li>a { display:block; font-size:1em; margin:0px; padding:0.5em; }
</style>
Also I recommend that you take a look at the concept of HTML box model: https://www.w3schools.com/css/css_boxmodel.asp

how to make the borders of icons equal sized

I have footer which has few icons.These icons have border around them.
The problem is that based on the icon,the border size is getting changed.But I need border with equal sizes for all the icons.
Could any one help me with this.
<div class="site-footer">
<div class="row">
<div class="col-lg-6">
<p class="box-1">
You can visit us at <span class="link-webiste" style="size: 70px !important;">agoodtreeproduction.com</span></p>
</div>
<div class="col-lg-6">
<h3 style="color: white;"> Around The Web</h3>
<ul class="list-inline">
<li class="footer-elements">
<i class="fa fa-facebook btn-outline icon" aria-hidden="true"></i>
</li>
<li class="footer-elements">
<i class="fa fa-twitter btn-outline icon" aria-hidden="true"></i>
</li>
<li class="footer-elements">
<i class="fa fa-google-plus btn-outline icon" aria-hidden="true"></i>
</li>
<li class="footer-elements">
<i class="fa fa-linkedin btn-outline icon" aria-hidden="true"></i>
</li>
</ul>
</div>
</div>
</div>
css
li {
display: inline;
}
.site-footer{
background-color: #6E2607;
//display: flex;
}
.box{
height:100px;
min-width: 200px;
}
.One{
//background-color: blue;
}
.two{
//background-color: yellow;
}
.box-1{
color: white !important;
}
.footer-elements{
padding: 20px;
}
.icon{
font-size: 30px !important;
}
.btn-outline{
color:#fff;
background:0;
border-style:solid;
border-radius:50%;
transition: background-color 0.7s ease-in-out;
margin-top: 5px;
padding: 25px;
}
.btn-outline:hover{
background-color: #000000;
}
Demo here:
https://jsfiddle.net/VijayVj7/zadx4rec/
Add a border-width to .btn-outline so it becomes:
.btn-outline{
color:#fff;
background:0;
border-style:solid;
border-radius:50%;
border-width: 20px;
transition: background-color 0.7s ease-in-out;
margin-top: 5px;
padding: 25px;
}
Where you change 20px to whatever you need it to be.
Creating equal widths for elements in the same row, while still allowing those elements to be flexible based on their content, is a good job for flexbox. As seen in this answer, you can set the parent element to display: flex, and each of your <li> tags to have flex-basis: 0 and flex-grow: 1. This is saying that each list item will start with no width, and what available growth there is will be equally distributed among all of them.
However, this setup is still going to make each item grow at least enough to fit its content. So you may have to use media queries to shrink your font size for the icons on smaller screens (otherwise you may end up outside the viewport, or longer text forcing a wider element), and/or consider setting flex-wrap: wrap on the parent (which would start a new line of icons once they can't be squeezed down any more).
Finally, I added box-sizing: border-box to the icons, so they account for padding with their widths. If you're not too far into the project, consider adding that declaration to the * selector (currently commented out), since it's generally seen as a more logical box model for elements.
The fiddle.

How to get icons to you the top of the main container

hey guys i am new to css in general , I am having a small problem with positioning a couple of social icons, basicaly , all i want to acheive is the following :
the social icons should be centered.
the social icons should touch the top of the main container div .
the 1st objective i have acheived , but i am having difficulty with the secound . , below is the HTML and CSS code :
HTML ::
<section id="contact-us" class="contact-us">
<div class="overlay">
<div class="social-icons">
<ul>
<li>
<a href="">
<i class="fa fa-twitter"></i>
</a>
</li>
<li>
<a href="">
<i>|</i>
</a>
</li>
<li>
<a href="">
<i class="fa fa-facebook"></i>
</a>
</li>
</ul>
</div>
</div>
</section>
CSS ::
html,body {
height: 100%;
}
.contact-us {
background: url(http://wallpaperswiki.com/wallpapers/2012/12/Abstract-Color-Point-1050x1400.jpg);
height: 100%;
}
.overlay {
height: 100%;
background: rgba(146,39,143,.5);
}
.social-icons {
text-align: center;
}
.social-icons ul {
list-style: none;
padding:0;
margin: 0;
display: inline-block;
}
.social-icons ul li {
margin-left: 5px;
margin-right: 5px;
display: inline-block;
}
.social-icons li a {
color: #fff;
}
.social-icons li a i {
font-size: 2em;
}
FIDDLE HERE
notice how the social icons are not touching the top of the main container. actually , all three elements , the 2 social icons and the line inbetween them should touch the top of the main container.
ON inspection :: i am using bootstap , and bootstap has a line-height of 1.42857 as default , if i make the line-height on social-icons to 0 the socia icons get closer to the top , NEARLY SOLVES MY PROBLEM . but still not all three icons are touching the top ? WHY ? and how do i solve this problem ?
EDIT ::
The output i want is the following :
Thank you.
Alex-z.

How to align list Items with font-awesome icon next line text?

A picture paints a thousand words. The text on the next line needs to align on same margin as above.
HTML:
<ul>
<li>
<p><em class="fa fa-square"></em><span>Name and surnafdddddddddddddds sdgfh dh hdfh df hdsh dfh dsfh sdfhdsfh sdf hsdfhdsfhme</span></p>
</li>
</ul>
CSS:
ul{
display: table;
a{
padding-left: 10px;
}
span{
padding-left: 10px;
}
}
Update:
After #panther update:
It is acceptable, however the fontawesome icon is now off centre.
You can try to use font awesome's built-in solution for lists:
Use fa-ul and fa-li to easily replace default bullets in unordered lists.
In your case, the code will change to something like this:
<ul class="fa-ul">
<li><i class="fa fa-square"></i><span>Name and surnafdddddddddddddds sdgfh dh hdfh df hdsh dfh dsfh sdfhdsfh sdf hsdfhdsfhme</li>
</ul>
You are probably looking for st. like this.
em {float: left;}
a, span {margin: 0 0 0 20px; display: block;}
Why not do these:
Apply position with a property value of relative to li to avoid overlap
Insert the square with :before selector and add position with a property value of Absolute o its block of CSS.
That way you can position it as needed. You have top, bottom, left, and right properties to work with as you position it.
HTML
<ul>
<li>
<p>Some important text are to be place here.
It may or may not longer than the text we have here. You never know.
</p>
</li>
</ul>
CSS
ul{
list-style-type: none;
}
li {
position: relative; /* Will help curtail overlap */
padding-left: 20px; /* Reserves a space for the square dot */
}
li:before {
content: '\f0c8';
position: absolute;
left: 0; /* Places the square dot at the space created by the LI padding */
font-family: fontAwesome;
}
See working example here
i think you are expecting like this
Fiddle
http://jsfiddle.net/myYUh/88/
I have added some example found on jsfiddle, i work around little bit. it might help you.
CSS
.icons-ul{
width:100px;
}
.icons-ul>li {
position: relative;
}
icons-ul {
margin-left: 2.142857142857143em;
list-style-type: none;
}
ul, ol {
margin-top: 0;
margin-bottom: 10px;
}
.icons-ul .icon-li {
position: absolute;
left: -2.142857142857143em;
width: 2.142857142857143em;
text-align: center;
line-height: inherit;
}
[class^="icon-"], [class*=" icon-"] {
display: inline;
width: auto;
height: auto;
line-height: normal;
vertical-align: baseline;
background-image: none;
background-position: 0% 0%;
background-repeat: repeat;
margin-top: 0;
}
HTML
<ul class="icons-ul">
<li><i class="icon-li icon-ok"></i>Bulleted lists (like this one)</li>
<li><i class="icon-li icon-ok"></i>Buttons</li>
<li><i class="icon-li icon-ok"></i>Button groups</li>
<li><i class="icon-li icon-ok"></i>Navigation</li>
<li><i class="icon-li icon-ok"></i>Prepended form inputs</li>
<li><i class="icon-li icon-ok"></i>…and many more with custom CSS</li>
</ul>
Late replay but check how I solved it.
ul li{ display: flex; padding: 10px 0; }
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css"
/>
<ul>
<li>
<i class="fa-solid fa-check"></i>
Font Awesome is the internet's icon library and toolkit used by millions of
designers, developers, and content creators.
</li>
<li>
<i class="fa-solid fa-check"></i>
Font Awesome is the internet's icon library and toolkit used by millions of
designers, developers, and content creators. Font Awesome is the internet's
icon library and toolkit used by millions of designers, developers, and
content creators.
</li>
<li>
<i class="fa-solid fa-check"></i>
Font Awesome is the internet's icon library and toolkit
</li>
<li>
<i class="fa-solid fa-check"></i>
Font Awesome is the internet's icon library and toolkit used by millions of
designers, developers, and content creators.
</li>
</ul>