Jump to content

So I'm trying to make a website in html5/css (Don't judge me,I started with the thing a few days ago)

So I made a basic <nav> and a dropdown box feature.

The whole thing worked all of the time since I made some minor edits and without looking saved and exited...

The problem right now is that the dropdown content of the dropdown box is behind a paragraph that was previously made.

Here are pictures of the current situation and the code:

 

Problem: http://imgur.com/a/p0bCM

 

html: http://imgur.com/a/RP4uv

CSS: http://imgur.com/a/s9BFc

 

if you need any additional info,I'm happy to add.

 

Thanks for the help.

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/
Share on other sites

Link to post
Share on other sites

Add z-index: 10 (or some other number greater than 0) to the css of the drop down box.

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8824421
Share on other sites

Link to post
Share on other sites

2 minutes ago, Enderman said:

Add z-index: 10 (or some other number greater than 0) to the css of the drop down box.

Tried, didn't work.

I tried adding it to the dropdown button and dropdown content (the box that pops up) individually but still doesn't work.

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8824439
Share on other sites

Link to post
Share on other sites

1 minute ago, lukazec said:

Tried, didn't work.

I tried adding it to the dropdown button and dropdown content (the box that pops up) individually but still doesn't work.

It should be added to whatever class your navbar is in, which should be a different class than what the paragraph is in.

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8824446
Share on other sites

Link to post
Share on other sites

I don't know how to exactly fix this, but I can leave with these notes:

  • Absolute positioning screws with the drawing. It basically makes several attributes harder to work with.
  • HTML renders each element from bottom to top. If you want to make sure your element is the top-most one without extra CSS, have it towards the bottom of the HTML.
Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8824447
Share on other sites

Link to post
Share on other sites

1 minute ago, Enderman said:

It should be added to whatever class your navbar is in, which should be a different class than what the paragraph is in.

The thing is,due to my inexperience, the navbar as a whole and the button with dropdown are different classes, since I wasn't sure how to integrate them together. But I'll try.

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8824460
Share on other sites

Link to post
Share on other sites

3 minutes ago, M.Yurizaki said:

I don't know how to exactly fix this, but I can leave with these notes:

  • Absolute positioning screws with the drawing. It basically makes several attributes harder to work with.
  • HTML renders each element from bottom to top. If you want to make sure your element is the top-most one without extra CSS, have it towards the bottom of the HTML.

The second point makes sense,I tried it but it just messes up the whole page.

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8824469
Share on other sites

Link to post
Share on other sites

4 minutes ago, M.Yurizaki said:

I don't know how to exactly fix this, but I can leave with these notes:

  • Absolute positioning screws with the drawing. It basically makes several attributes harder to work with.
  • HTML renders each element from bottom to top. If you want to make sure your element is the top-most one without extra CSS, have it towards the bottom of the HTML.

And is there any alternative to absolute positioning?

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8824471
Share on other sites

Link to post
Share on other sites

2 minutes ago, lukazec said:

The thing is,due to my inexperience, the navbar as a whole and the button with dropdown are different classes, since I wasn't sure how to integrate them together. But I'll try.

w3.css has some good examples of dropdown navbars, try checking those out.

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8824473
Share on other sites

Link to post
Share on other sites

7 minutes ago, lukazec said:

And is there any alternative to absolute positioning?

http://www.barelyfitz.com/screencast/html-training/css/positioning/

 

I read, probably on Stack Exchange or similar, that absolute positioning is for people who couldn't be bothered to figure out how to position their divs properly. While that sounds harsh, I've had scenarios where absolute positioning would make modifying the HTML a nightmare. An example of this is a row of divs that needed to be spaced specifically. I got this down in a few classes so that all I have to do if I want to add another div, I just create a div with those classes. If I used absolute positioning, then I would have to make an entirely new class just for that div. So maintenance would be a problem if I wanted to change the spacing.

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8824496
Share on other sites

Link to post
Share on other sites

36 minutes ago, M.Yurizaki said:

http://www.barelyfitz.com/screencast/html-training/css/positioning/

 

I read, probably on Stack Exchange or similar, that absolute positioning is for people who couldn't be bothered to figure out how to position their divs properly. While that sounds harsh, I've had scenarios where absolute positioning would make modifying the HTML a nightmare. An example of this is a row of divs that needed to be spaced specifically. I got this down in a few classes so that all I have to do if I want to add another div, I just create a div with those classes. If I used absolute positioning, then I would have to make an entirely new class just for that div. So maintenance would be a problem if I wanted to change the spacing.

Well I managed to fix the problem.

I just had to change the position of the paragraph below it to relative and THEN add z-index: -10; to it.

Adding relative position to the dropdown menu makes it push all the content below it when opened.

So yeah new lesson for me.

Thanks for the help.

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8824755
Share on other sites

Link to post
Share on other sites

Any reason why you're not using bootstrap?

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8827925
Share on other sites

Link to post
Share on other sites

1 minute ago, lukazec said:

Didn't know about it.. Will check it out.

Frameworks are awesome and reduce development time.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8828346
Share on other sites

Link to post
Share on other sites

4 minutes ago, lukazec said:

Well,thanks for the suggestion and help :D

Just be aware that bootstrap does require JS enabled in the browser, another option would be SaaS or even angularJS

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8828387
Share on other sites

Link to post
Share on other sites

1 hour ago, lukazec said:

Will take that into account.

And I didn't know about it because I pretty much started with HTML and CSS a few days ago,so I'm not yet completely into all the useful tools and stuff.

 

building it yourself is a great way to learn but you end up wasting time writing code that a framework that would have done it in a shorter time frame. 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/687409-html-css-problem-help/#findComment-8828879
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×