Skip to content
Advertisement

Creating a slider with a menu bar – The heading as a link isn’t aligning up correctly

I hope you’re all well. I am using a code that I took from Codepen, many may come across this before, I am trying to use this code as a navigation menu with the text as a link to the section/page. The text isn’t aligning correctly. Please bear in mind, that I am still new to HTML and CSS and exploring code to create usable websites. I am aware that the text container will need a anchor link for it to become a menu – this is not the issue. I really appreciate your time.

Code: HTML

JavaScript

/* Import and merge normalized.css stylesheet*/ @import “./normalize.css”;

JavaScript

JS: //Slideshow slider

JavaScript

Thank you.

Advertisement

Answer

You have to add the margin-top:30px; to the CSS class slideshow-text.

Updated the CSS class

JavaScript

enter image description here CSS Margin:

The CSS margin properties are used to create space around elements, outside of any defined borders.

With CSS, you have full control over the margins. There are properties for setting the margin for each side of an element (top, right, bottom, and left).

CSS has properties for specifying the margin for each side of an element:

  • margin-top
  • margin-right
  • margin-bottom
  • margin-left

iPhone SE screenshot: iPhone SE Moto G4 screenshot: Moto G4 DEMO Link

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement