Relative Positioning in CSS - css

.loading-icon {
pointer-events: none;
margin: auto;
display: inline-block;
width: 32px;
height: 32px;
border-radius: 16px;
position: relative;
margin: 50px 0;
line-height: 25px;
In firefox and chrome, the object is centered in the page, whereas on IE10 the object is not centered and appears towards the left

You have 2 margin attributes. Chrome and Firefox handle it one way and IE handles it another.
Delete the duplicate and change the first to:
margin: 50px auto;
Also as mentioned in the comments, change display: inline-block; to
display: block; or just delete it.

Related

overflow auto not working - scrolling frozen

I've never had this problem before, but for some reason, my 'overflow: auto' tags are not working correctly. They show scrollbars, but I can't actually scroll the scrollbars. The scrollbar appears if a section is larger than the height of the container, as it should, but the actual scrolling capability is defunct. It's as if the scrollbar is simply frozen and won't move. I've searched across the internet for why this may be happening, and couldn't find an appropriate solution. I also tried removing the 'overflow: hidden' from my parent element, thinking that it may somehow be affecting the entire code, but removing that elicited no effect whatsoever. I've also double-checked that everything has a width and height, since I know that missing those can adversely affect an overflow. I also checked the positioning of each item. (And I also know it isn't just my mouse messing up because scrolling on other sites/pages is perfectly fine)
I'm frustrated and entirely at a loss at this point, so I'm hoping extra sets of eyes may spot something that I'm missing.
Here is my project: https://codepen.io/royalstandard/pen/RwMxrLB
Main container -
.ldmainprofile {
width: 1100px;
height: 1400px;
padding: 0px;
background-image: linear-gradient(80deg, rgba(163,135,135,1.0), rgba(163,135,163,1.0));
border-radius: 15px;
position: relative;
overflow: hidden;
z-index: -10;
}
The first "frozen" container -
.basics {
height: 300px;
width: 270px;
border: 20px solid rgba(92,65,92,0.6);
background-color: #CCC;
border-radius: 10px;
position: absolute;
margin: 20px;
}
.basics ttl {
display: block;
font-family: aclonica;
font-size: 22px;
height: 22px;
width: 250px;
text-align: center;
padding: 20px 10px 10px 10px;
border-bottom: 1px dotted #888;
color: rgba(92,65,92,0.8);
}
.basicscroll {
height: 247px;
width: 240px;
background-color: #FF7777;
padding: 0px 15px;
overflow: auto;
}
.basics cat {
display: block;
font-family: poppins;
font-size: 15px;
text-align: left;
margin: 10px 0px 10px 10px;
color: rgba(92,65,92,0.6);
letter-spacing: 1px;
text-decoration: underline rgba(92,65,92,0.3) 4px;
}
The sections being affected so far are ".basicscroll" (currently coded with peach color as I do to clearly see what I'm working on) and ".info2 trig" at the bottom.

margin-left doesn't work in Firefox

In my code margin-left: is working only in the other browsers. In Firefox it seems I need to double every values i give to the margin-left: that works for the other browers. The element i need to marge is the blue circle.
If I inspect the element and change the css in the inspector and then i give margin-left: 60px (my margin-left: is normally 30px) it works. The same goes for 1em (is i put a 2em it works).
I just strated a formation so i'm not an expert, so if one of you can see where I've made a mistake, thanks in advance for telling me !
Here's my code
.cercle-logo {
height: 65px;
width: 65px;
color: #5CADD3;
border: 2px solid #EBEBEB;
margin-top: 15px;
border-radius: 100%;
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
}
.cercle-logo:before {
content: "";
border: 5px solid white;
width: 24px;
height: 24px;
border-radius: 100%;
background-color: #5cadd3;
position: absolute;
margin-left: 2em;
box-sizing: border-box;
}
<div>
<span class="cercle-logo"><i class="fa fa-chart-pie fa-2x"></i></span>
</div>
Some browser use the parent padding as an offset for the absolute position child elements (chrome does this), because it's obvious that you will move the element using left,right,top,bottom not the margins
Say you have padding-left:20px, on the parent, and you set position absolute on one of it's children, if you won't see much changes, because some browsers uses that 20px and add it as an offset left:20px
One simple solution is to rest the offset, then use margins to push it, which i don't recommend you can use the left property to push it.
.cercle-logo {
height: 65px;
width: 65px;
color: #5CADD3;
border: 2px solid #EBEBEB;
margin-top: 15px;
border-radius: 100%;
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
}
.cercle-logo:before {
content: "";
border: 5px solid white;
width: 24px;
height: 24px;
border-radius: 100%;
background-color: #5cadd3;
position: absolute;
left: 3.7em;
box-sizing: border-box;
}
<div>
<span class="cercle-logo"><i class="fa fa-chart-pie fa-2x"></i></span>
</div>
Thank you for your answer but I might have done something wrong because even though your explanation were clear, and the "code snippet" works well (I test it directly on Firefox), when i write is in Bracket and test it, it moves my blue circle totally on the left but this time on every browsers ...
Is there something I missed ?
Thank you for your time anyway !

IE11 width calc() not evaluating in border & padding when using inline-table or inline-block

I am having an issue with IE11 and utilizing the CSS calc() function along with display: inline-block and/or display: inline-table.
Currently I have a text input and a button that should be next to each other (inline), with the button always being a fixed width and the input should take up the available space leftover (i.e. calc(100% - 92px)). Both elements are display: inline-table;. In all other browsers, doing this calc() worked fine. In IE11, it drops the button to the next line.
Included in the JSBin are a couple styles at the bottom that make the elements appear inline, although this fix will not work for an end result. What I did was added display:inline-block to both the input & button and also removed padding and border from the input. At the end of the day, the input **must have padding & border` so this will not work for my use case.
^^ box-sizing: border-box fixed that "hack", but the issue as a whole still exists in IE11.
Here is the JSBin (in order to see the issue, you must be using IE11)
The CSS, as it stands now, looks like this...
body, dd, figure, form {
margin: 0;
}
form {
margin-top: 1.6875rem;
width: 100%;
margin-right: auto;
margin-left: auto;
}
form fieldset {
margin: 0;
padding: 0;
border:0;
}
input {
border: none;
border-radius: 0;
outline: 0;
margin: 0;
padding: 0;
text-align: left;
}
input {
font-size: 12px;
line-height: 15px;
display: inline-table;
padding: 4px 12px 5px;
border: 1px solid #000;
border-radius: 0;
background-color: #fff;
color: #999;
font-style: italic;
font-weight: 300;
vertical-align: top;
margin: 6px 0 14px;
margin-top: 0;
margin-bottom: 0;
width: calc(100% - 92px);
height: 40px;
}
button {
border: 0;
height: 40px;
text-transform: uppercase;
margin-top: 0;
margin-bottom: 0;
font-size: 13px;
display: inline-table;
position: relative;
padding: 0;
background-color: #000;
color: #fff;
width: 92px;
}
I'm assuming there is a bug with IE11 and calc() in which calc() doesn't take into account the border/padding when an element is display:inline-block or display:inline-table, although I could not find anything in my research to suggest this 100%.
Ultimately my question is, how do I get two elements to be "inline" with one being a fixed pixel value and the other a percentage width that is cross browser compliant.
EDIT: added box-sizing: border-box which made the display: inline and padding/border: 0 obsolete at the bottom of the JSBin. The issue still persists in IE11 though.
The answer to my question is as follows...
As Adam mentioned in the comments above, adding box-sizing: border-box; to, at the very least, the input & button elements fixed the issue where the border/padding was not being calculated in the calc() function.
In addition to that, changing display: inline-table to display: inline-block fixed the issue in IE11.

Why is there extra padding happening in my div?

I've coded my website for all browsers but of course IE has issues. Specifically only IE 7. I'm hoping to find a resolution to why it's behaving the way it is with two issues and what I can add so IE will display it properly.
My submit buttons are aligning to the bottom of their containing divs.
CSS for the SUBMIT button for the SEARCH field
#searchform { /*container widget */ position: relative; left: 15px; width: 97%; height: 30px; background-color: #f3f3f3; border: 2px solid #742222;}
#searchform label { display: none; }
#searchform input#s { width: 75%; height: 20px;}
input[type=text],input#s { margin: 0 10px 0 0; width: 60%; }
#searchsubmit{ position: relative; float: right; width: 30px; height: 30px; text-indent: -999px; background: url(http://averylawoffice.ca/img/SEARCH-submit.jpg) center; border: 0px;}
This CSS works in all browsers but IE version 7. Is there a way to make it top align without having to position absolute?
I've managed to move the SUBMIT button up (to the correct position) by left-floating the text-box.
.subscription_email {
...
float: left;
}
Same goes for the search text-box:
#s {
...
float: left;
}
By making those changes, the resulting presentation will be exactly the same as in Firefox.

div line doesnt show up correctly ie6 floated left

I have a similar problem to this question Why does my floated left div go to the next line in IE6 using the 960.gs?
In my design, the subcategories should be 4 per row. They look fine in FF,Safari,Chrome, but in ie6 they only show 3 per row. I tried creating a different css for ie6, but it didnt work, also i tried reducing the width and padding of each row, but still i have 3 subcategories per row.
I asked again because i bet the solution can be very specific to the css you have.
try setting width of each .subcategory at 24% or max 237px
.subcategory
{
width:24%;
}
updated
in category.css change in this way:
.subcategory {
FLOAT: left; MARGIN-BOTTOM: 15px; WIDTH: 24%; HEIGHT: 230px; TEXT-ALIGN: center
}
.category-item-image {
DISPLAY: block; BACKGROUND: #fff; MARGIN: 5px 30px; WIDTH: 170px; PADDING-TOP: 5px; HEIGHT: 170px; oveflow: hidden
}
.subcategory-image {
DISPLAY: block; BACKGROUND: #fff; MARGIN: 5px 30px; WIDTH: 170px; PADDING-TOP: 5px; HEIGHT: 170px; oveflow: hidden
}
Problems are
MARGIN: 5px 34px;
and
WIDTH: 25%;
I've tried to set them at 30px and 24% and in IE6 it works!

Resources