Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have a quick question about CSS positioning. I have already looked up all about absolute, relative, static etc but am still having problems. So, for example, on one of my webpages, I am using four different div's for the four seperate sections I have on the page. I can manage to position them so they look perfect, but the top left section expands as the user adds entrys. When it expands, it then overlaps the section below it. Same with the other side, the section expands a little if it needs to display error messages and overlaps the section below it. Any suggestions as to how I would overcome this?
Thank you !!
If you want divs to flow normally on a page, you don't have to use positioning. Generally, if you are using positioning, you use it for a div that you want to have in a specific place that would in a normal situation, be somewhere else. For example: you would position something relatively if you wanted it to actually escape the container it is in. You would position something absolutely if you want it to be in exactly the same place, no matter what (this includes scrolling) OR if you want to overlap divs using a z-index.
Usually, if you just want divs to line up side by side, you can display: inline or use float.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am facing problem with overlapping div.
Please refer site my site : http://ayurved-infertility.in/index.html
As you can see in the site, top menu and left menu is inside div which is in absolute position and moving with the screen. And content is just behind the absolute div. Also I given background as transparent. so, we can see the behind text easily.
Now, my problem is if I put any hyperlink to the text that is just behind the absolute div, no-one can be able to click on the link because absolute div is overlapping.
So, how can I overcome from this problem ? If it is not possible then please suggest me a better way so, that my website look and functionality doesn't change and I can be able to click on hyperlink in the text.
First of all you could remove the height:500px of the element shown in the screenshot. Now you can click part of the text (green area).
After that you can either remove the left nav and be done with it.
Or place it outside of the table element and give it a fixed position. This is the quickest and easiest solution I can come up with.
In general you shouldn't be using this table method of positioning stuff on a website at all.
Your floating/absolute divs should only be as wide as your left menu item
The DIV surrounding your DL (the menu) should be
width:140px;
position:absolute;
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I was wondering when styling some of my website's what the correct use of the top, right, left, bottom properties are.
This would sound like an way too open question so I am narrowing it down to this: Let's say if I am styling some text that I want at the bottom of my page would it be correct to use something like bottom: 265px;?
This would give the desired result however is this also considered clean code and a correct use of this function?
Or would there be a better option for this. I am wondering this because I also have to make my site's responsive as well.
I have had a read through W3schools - CSS Positioning and Stackoverflow Question - CSS Positioning but it did not have the anwser I am looking for
You use top, bottom, left, and right to place absolute-positioned content.
There are certainly cases where absolute positioning is the best and cleanest approach. The problem is that it's too easy to overuse, which can lead to very fragile layouts.
Signs that you're overusing absolute-positioning:
every time you change something in the page you end up having to
update a lot of absolute-positioned elements
different content (a too-long header, or a too-short paragraph, or etc) causes things to overlap unintentionally
your layout only works for specific screen sizes, and doesn't flow to match the browser window width
It's almost always better to start by letting the browser do most of the work, depend on document flow to position the majority of the content, and reserve absolute positioning for only the elements that really truly need to be in exactly the same place no matter what else is going on on the page. In practice, most of the time, this tends to be relatively few (or no) elements.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I've been trying several solutions, but the clickable areas for links in my navigation sidebar aren't where they should be. I'm just looking to get the entire div or even just the text inside to be a link.
http://prelude2cinematestsite.weebly.com/
If you hover at the very top of "home" you'll finally locate one of the links. One of the solutions I attempted very early seemed to finally fix the problem, but then caused the entire sidebar to have scroll for width and push the social media icons down passed the bottom of the screen where they refused to budge. Unfortunately I can't seem to find this solution anymore since it's the only one that actually did what I wanted even if it broke a lot of other things.
There was originally supposed to be drop down menus, but even taking them out didn't seem to help.
And this isn't a problem with Weebly, I've checked that.
You do not need to apply position:absolute to the .sidebar-nav div and the #social div. Make them position: relative. They will automatically fall one below the other just as you need them. Then, remove the excessive padding that you've used on the divs to re-position them.
Currently, since the two are positioned absolutely, the social div is overlapping on top of the .sidebar-nav div and inadvertently preventing you from clicking on the buttons.
Adding a negative z-index to #social in your css file will solve your immediate problem but it looks like you may still have to work on the mobile version of your navigation.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
A friend ask me to take a look on one issue on his site. In the portfolio section on the website, there is a border around the div and a rollover evect when the images are hovered. However, there is one weird issue, the height of the box containing the image and all data is larger by 5px in height.
The image is square, and all of the parent elements have width and height elements set to 100%, there are no paddings or margins that could have caused this, so I can't seem to find a reason for this.
Could anyone point to a location where is this happening and how to fix it?
A sample code describing this problem can be seen here.
Thanks!
Your code is heavily awful, but putting display: block on the images will fix it.
The reason is that images are inline elements, so you will get some phantom padding to the bottom to account for things like the bottom of g, p, q, etc.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Have created a div and another div stays adjacent to it but I put an hr to right aligned div but want it to expand from right to left.
If you are simply using <hr>, clear your space for a line then it will automatically cover the whole region. Keep your both division inside a division and put <hr> in you main division. It would be better if you show your code.
It will span the whole way through if you put it in the top level div.
You can also add CSS to it to make it stretch nicely, but that's another story.