I have implemented AddThis plugin in my website, however, when I resize the browser's width and before it hits the #meduim screen style the more layer get displayed in a wrong floating position.
I snapped this css from their out of the box implementation
element.style
{
z-index: 1000000;
position: absolute;
visibility: visible;
top: 681px;
left: 753px;
display: none;
}
#at15s.atm
{
background: none!important;
padding: 0!important;
width: 160px!important;
}
I do reference this js file provided by them, and it takes care of the css I guess. What css should I share with you guys to get familiar with this problem so you may give me suggestions for the floating problem?
I just had the same problem and i added this little css to my page and now the more-layer opens up to the left instead to the right.
You should then try to reset these style´s in your media queries for smaller screens.
#at15s.atm {
left:auto !important;
right:0 !important;
}
Related
Can't seem to source why the image in this full-width slider, when the browser window is fully expanded, gets overlapped slightly by the menu above it.
It looks perfect in mobile, tablet, it's desktop that is posing the problem. Here's a link, open and close the window and you'll see what I mean:
[linked removed]
thanks!
Aha! Found it!
Ok so when your window is small enough to "qualify" as a mobile device, you have one very important property set on your header:
position: static;
This means that the header is in the flow of the document. When you change to desktop size, that gets changed to
position: fixed;
This takes the top header out of the flow of the document, sliding the other content up into its place.
So, to fix this, you can do something like this:
#media screen and (min-width: 700px) /*<--your min desktop width here*/
{
body
{
margin-top: 40px; /*header height here*/
}
}
Was doing some detective work, two things happened, one, I added a fix for a Chrome bug earlier on in the header:
body:after {
display: initial;
position: absolute;
top: 0;
visibility: hidden;
}
And second, needed to compensate for it with padding:
.iosSlider .slider .item img {
width: 100%;
height: auto;
float: left;
padding-top: 15px;
}
Domino effect.
use below code in navigation div css file
position: relative;
z-index: 100;
I have a few issues that I can't really get.
a. If I do something like:
position: absolute;
top: 0px;
width: 100%;
padding: 10px;
Scrollsbars in my browser will appear. How to avoid that? I want my top bar to be full width, with padded content but I don't want it to exceed real width and make scrollbars appear. How to do that?
b. Do you have any articles on how to scale website elements according to user's resolution? When I try it with
position: absolute;
top: (some percentage)%
left: (some percentage)%
It's never accurate. With pixels instead of percents - it's not accurate either for different resolutions.
c. Menu overlay
Is there any way to level divs so that my drop-down css-only menu doesn't appear BEHIND divs ? When that happens, I can't click on certain items in that menu because they hide behind a body div.
Thanks in advance!
a. add box-sizing: border-box; -moz-box-sizing: border-box to your code. It will make the padding be within the 100% width, check here for more info and here for a demo
b. try searching the web for responsive designs. Plenty to find about how to display your website based on different devices. You probably don't want to scale everything.
c. are you looking for z-index? Can't help you any more than that with the information you give. Add your HTML/CSS code if you need to know more.
All of your issues are solved with plain ole CSS, so that's good news!
Padding
This is because of the way CSS handles padding. So for instance if you set your element to be:
#id{
width:100px;
height:100px;
padding:10px;
}
It would actually end up being 120px x 120px . This is explained here http://www.w3.org/TR/CSS2/box.html.
You can solve this by using the box-sizing method detailed here http://www.paulirish.com/2012/box-sizing-border-box-ftw/
Scaling depending on Resolution
This is called responsive design. It's really too much to cover here but the basics is that you use media queries to do this. That is detailed here http://css-tricks.com/css-media-queries/
Menu Overlay
You can solve this with the z-index property given to you by CSS. That works essentially like this: z-index:1 is below z-index:2. The caveat is that z-index will only work if a position is declared on your element.
http://css-tricks.com/almanac/properties/z/z-index/
Again, no js is needed here and that's great news because CSS will be much faster for you and much more scalable.
a)
of course scrollbars will appear because you have a with of 100% + 10px
what you can do is:
position: absolute;
top: 0px;
width: 100%;
padding: 0;
or
position: absolute;
top: 0px;
width: 90%;
padding: 10px; // if screen allows it
b)
to scale pages acording to resolution I highly recommend you bootstrap it is really easy and really fast to make your page multidevice http://getbootstrap.com/
What you want to do is use the attribute:
box-sizing: border-box;
As shown here: http://jsfiddle.net/se34t/1/ This allows the padding to be calculated within the 100% width.
I'm having some issues with a webpage of mine, mainly on mobile devices but it also affects desktop devices too, I would be willing to award a bounty (as and when stackoverflow allows me) to whomever can help with these problems
HTML: http://pastebin.com/raw.php?i=bbFsMcwT
CSS: http://pastebin.com/raw.php?i=SGMwt3cs
JSFiddle: http://jsfiddle.net/D8SJD/
Issue 1 - Left/Right Scroll Image Buttons
Currently my left and right scroll image buttons are done in html using onmouseover and onmouseout I want to be able to convert them into css based "buttons"
Issue 2 - Dynamic Resolution(s)
The header and footers aren't dynamic with different resolutions for example, I created the page designed on a 1680x1050 monitor which looks like: Desktop 1680x1050 however making the window smaller it looks like: Desktop Small Window
On a Nexus 4 mobile phone on default zoom it looks like: Mobile Original Zoom
On a Nexus 4 mobile phone zoomed out to as far as it can go it looks like: Mobile Max Distance
On a Nexus 4 zoomed out and scrolled to the bottom (so that the browsers URL bar disappears) it looks like: Zoomed out without URL bar (the footer of the actual webpage vanishes)
On a Nexus 4 zoomed out and scrolled just off from the bottom (so that the browsers URL bar is visible) it looks like: Zoomed out with URL bar (the footer returns)
.
The placeholder image and arrows are supposed to be in the center of the footer and headers and should shrink in accordance to the screen resolution.
Mobile device default zoom (if possible) needs to be decreased so they can see more and on getting smaller (if possible) if it gets close to Mobile Original Zoom then the Up to Top, Down to Key, placeholder logos should vanish...
Please see images at bottom of this post
For the mobile devices I tried things like below just for testing but none of them worked...
#media (max-width: 640px) {
#header > a img {
display: none;
}
}
EDIT 14/11/2013 # 01:58GMT
On a 1920x1080 screen it looks kind of okay although there is a big gap between the text and the placeholder image as seen below:
On a 1680x1050 screen it looks roughly how it should take note of where "Semi" is located and compare to the 1920x1080 image from above.
On a 600x600 screen it appears as follows, which as you can see there is a big gap between the placeholder and the left arrow but on the right arrow there is no gap and infact it overflows, as for the text it too is too far to the right.
Type
#media screen and (max-width:640px) {
/* Your specific styles go here */
}
and dont forget to add
<meta name="viewport" content="width=device-width,initial-scale=1.0">
Hope that helps :-)
I see a border around your links, remove from your links:
a{
border:none ;
}
for first issue you can do it with CSS, just remove <img> tag inside <a> tag like this:
<div class="footleft">
<a class="def" href="javascript: void(0);">
</a>
</div>
create image buttons like this:
then set background to <a> tag like this:
#footer .footleft a {
width: 100px;
height: 47px;
display: block;
background: url(path/to/leftarrow.png);
background-position: 0 0;
}
#footer .footright a{
width: 100px;
height: 47px;
display: block;
background: url(path/to/rightarrow.png);
background-position: 0 0;
}
#footer .footleft a:hover , #footer .footright a:hover{
background-position: 0 100%;
}
second issue, I think if you remove position:absolute; from #header .headimage and #footer .footimage it will be okay.
and if your want to centerize headmid and footmid and footmidtwo you have two choices,
First: set fixed width to them and use CSS like this:
#footer .footmid {
top: 50%;
left: 50%;
position: absolute;
font-size: 15px;
width: 292px;
margin-left: -146px;
}
#footer .footmidtwo {
top: 70%;
left: 50%;
position: absolute;
font-size: 15px;
width: 126px;
margin-left: -63px;
}
#header .headmid {
top: 60%;
left: 50%;
position: absolute;
font-size: 15px;
width: 302px;
margin-left: -151px;
}
Second: if you need to have dynamic width you can use this CSS and JQuery:
CSS:
#header .headmid {
top: 60%;
left: 50%;
position: absolute;
font-size: 15px;
}
#footer .footmid {
top: 50%;
left: 50%;
position: absolute;
font-size: 15px;
}
#footer .footmidtwo {
top: 70%;
left: 50%;
position: absolute;
font-size: 15px;
}
JQuery:
var $widthhead = $(".headmid").width();
var $widthfoot = $(".footmid").width();
var $widthfoot2 = $(".footmidtwo").width();
$(".headmid").css("margin-left",$widthhead/2*(-1));
$(".footmid").css("margin-left",$widthfoot/2*(-1));
$(".footmidtwo").css("margin-left",$widthfoot2/2*(-1));
jsFiddle is here
Okay I've tried to filter out all of the irrelevant code for this solution.
See the solution here.
Most of the time, it is best to use relative positioning to fit elements absolutely inside of another element. In your case, with three different strings to fit in a 300x80 window, it's a bit crowded. I tried to place things in a logical position to demonstrate.
By placing a container in the footimage div with relative position, you can then place every element inside the footimage div absolutely relavtive to the footimage div, rather than to the entire page.
For example, what you had:
#footer .footmid
{
position: absolute;
top: 50%;
left: 50%;
}
Will place the div of class footmid at a position 50% of the page height from the top of the page and 50% of the page width from the left of the page:
This will work if every user that visits your page has the exact same resolution, however it causes problems when the don't. Obviously, this isn't a perfect world, so different resolutions will visit your page.
What you can do is use relative positioning!
Basically I tell CSS that instead of moving 50% from the top and left of the window, move 50% from the top and left of the nearest parent element with relative positioning:
You can modify the bottom, left, and right attributes of my fiddle to move the footmid elements within the relative element .footimageContainer that is the same size and in the same position as the .footimage.
As far as your arrows, I wasn't quite sure what you were trying to accomplish; your question was pretty vague, so I simply made them fade out slightly when you mouseover them. Any mouseover/out events can be handled using CSS psuedo-elements.
.element //Native and mouseout
{}
.element:hover //onmouseover
{}
Remember that if you use pseudo-elements, you have to specify the attribute that will be changing in both the native and :hover rules.
.element
{color:red;}
.element
{color:black;}
If you have any additional questions on the arrows, let me know and I'll revise my answer.
http://jsfiddle.net/D8SJD/4/
Instead of using absolute positioning, you can just take advantage of the text-align center and images and text will center automatically.
If you want offset from center, try position:relative, and top, left, right etc and it will move relative to it's central position.
Elements that are display:inline; or display:inline-block; will align according to parents text-align property, in this case text-align:center.
#footer .footimage {
display:inline;
position:relative;
top:-10px;
}
#footer .footmid {
top: 50%;
width:100%;
position: absolute;
font-size: 15px;
}
#footer .footmidtwo {
top: 70%;
width:100%;
position: absolute;
font-size: 15px;
}
As per issue 2, i could be wrong but when targeting the image through the structure of the site
i.e.
headImg a img{...}
The style wouldn't work. But if you add classes to the images the style will work; the case could be that there are some unclosed divs or elements messing with the architecture.
<div class="headimage">
<img class="placeholder" src="http://placehold.it/300x80"/>
</div>
#media screen and (max-width: 640px) {
.placeholder {
display: none;
}
}
JsFiddle here - http://jsfiddle.net/Q5bEb/
I have implemented the Chosen Plug-in on my web page and it worked great. Recently I decided to switch over to the 960 grid system to give my page a facelift. When I did this though, the styles in the Chosen Plug-in seem to be messing with the grid system causing the outlines on the grid to go off of the screen to the left. I have a feeling this has to do something with how the grid is floated relatively and the styles in the plug in are just throwing it off. However, I can't seem to find what exactly in the styles that is causing this or how I can change it. Has anyone had any experience with this plug in who might be able to give me advice? I would rather not have to strip this plug in, since functionally, it works great!
EDIT: Although, when I click on the drop down, the styles seem to look right. It is only when the drop down items are not showing.
Figured this one out.
I had to change the CSS property of the dropdown to display: none instead of absolute positioning -99999px left.
Here is my code:
.chzn-container .chzn-drop {
width: 100% !important;
display: none;
background: #f6fbfd;
border: 1px solid #9fbeca;
border-top: 0;
position: absolute;
top: 100%;
left: 0;
z-index: 900;
width: 100% !important; /*to line up the right side visually*/
-moz-box-sizing : border-box;
-ms-box-sizing : border-box;
-webkit-box-sizing: border-box;
-khtml-box-sizing : border-box;
box-sizing: border-box;
Then I just set the value to inline here:
.chzn-container.chzn-with-drop .chzn-drop {
left: 0;
display: inline;
}
I'm using jQuery to create a "dialog" that should pop up on top of the page and in the center of the page (vertically and horizontally). How should I go about making it stay in the center of the page (even when the user resizes or scrolls?)
I would use
position: fixed;
top: 50%;
left: 50%;
margin-left: -(dialogwidth/2);
margin-top: -(dialogheight/2);
but with this solution and a browsers viewport-size of less than your dialog is, parts of the dialog will be unreachable on top and left sides because they are outside the viewport.
So you have to decide if it's suitable for your dialogs size.
(CSS doesn't know how to calculate, yet. So the little math over there has to be done by you, right now. Therefore your dialog has to be a fixed size which you have to know.)
Edit:
Oh yes, if you want to serve your dialog for the IE6 too, you should do something like this:
#dialog { position: absolute; }
#dialog[id] { position: fixed; }
Since IE6 is not capable of fixed positions and also not capable of attribute-selectors, the IE6 will be the only one who has the position set to absolute. (This will only affect with scrolling behaviour. absolute stays on its place in page and fixed stays on its place in the browser. The rest is similar.)
Check out Infinity Web Design's piece on this.
#mydiv {
background-color:#F3F3F3;
border:1px solid #CCCCCC;
height:18em;
left:50%;
margin-left:-15em;
margin-top:-9em;
position:absolute;
top:50%;
width:30em;
}
This is the CSS they use, and I've tested it out in multiple browsers.
You'll note that the left margin is negative half the width and the top margin is negative half the height. This takes care of the centering, more or less, with absolutely positioning it at 50% top and left.
To put a div horizontally in the middle I always put margin: 0 auto. But it cannot be a floating element and in IE I always needed to put a div around and then give it the property text-align: center, so that the inside div is centered horizontally.
If you know the element's offset dimensions (width/height + padding), you can use this CSS:
elementContainerSelector {
position: fixed; /* You'll of course need to handle browsers that don't support fixed positioning */
top: 0;
left: 0;
width: 100%;
height: 100%;
}
elementSelector {
position: absolute;
top: 50%;
left: 50%;
margin: -[half of offset height]px 0 0 -[half of offset width]px;
}
Hurix's answer works too, and bear in mind the caveats in that answer as well.
Keep margin-left:auto and margin-right:auto