Why changes in <main> affect the <header>? - html

So I'm creating a site and one of the problems is that when I change the margins for content a link from the header can be presses only in the left-margin of the screen on mobile mode.
because of this the first tag gets broken and can be pressed only in the left margin of the screen
Here is the source code: https://github.com/mcosminc/mcosminc.github.io
The problem occurs in the index.html (in the at ) and style.css ( in the #media and screen(max-width:500) )
I tried to make the text content on mobile more easy to read, but setting the margins resulted in the first tag from the navbar to get broken and only be able to be clicked in the left-margin of the screen. This problem occurs only in mobile mode, to check it more easy here is the place where I hosted it: mcosminc.github.io
Here is the Code:
#media screen and (max-width: 500px) {
.ref-text{
display: none;
}
.main:not(#article-video){
margin-left: 1rem;
margin-right: 1rem;
}
hr{
margin-left: 1rem;
width: 90%;
}
}
}
<header>
<div class="navbar">
<a class="menu-bars" id="show-menu">
<i class="fas fa-bars"></i>
</a>
<ul id="referinta">
<li class="ref-text">Impactul COVID-19 asupra antreprenoriatului și comportamentului consumatorilor</li>
</ul>
<div class="mode">
<a class="day-mode invisible">
<i class="far fa-sun icon" id="sun"></i>
</a>
<a class="night-mode">
<i class="far fa-moon icon" id="moon"></i>
</a>
</div>
</div>
<nav id="nav-menu">
<ul class="nav-menu-toggle">
<a class="menu-bars-toggle" id="hide-menu">
<i class="fas fa-bars icon-bars"></i>
</a>
<hr />
<div class="nav-section">
<li class="nav-text"></i> Home</li>
<li class="nav-text"><i class="fa fa-youtube nav-icon s-icon"></i> Youtube</li>
</div>
<hr />
<p id="copy">Creat de <br>Ciovina Mihaita Cosmin</p>
</ul>
</nav>
<script src="app.js"></script>
</header>

i tried your code and i didn't find your problem but i just male a suggest to use padding instead of margin.

Related

Hiding font awsome icon on full screen desktop

I want to hide a telephone icon I've added when the browser is full screen desktop mode. I am using the template which is online here: https://sartre.thememountain.com/index-architecture-2.html
So far in mobile mode it looks ok. When I expand to full screen, the icon is floating in the corner. I want to hide fa-phone from view.
<header class="header header-fixed header-fixed-on-mobile header-transparent" data-bkg-threshold="100">
<div class="header-inner">
<div class="row nav-bar">
<div class="column width-12 nav-bar-inner">
<i class="fa fa-phone"></i>
<i class="far fa-envelope"></i>
<div class="logo">
<div class="logo-inner">
<img src="images/architecture/logo-dark.png" alt="Happy Kids Logo" />
<img src="images/architecture/logo-dark.png" alt="Happy Kids Logo" />
</div>
</div>
<nav class="navigation nav-block secondary-navigation nav-right">
<ul>
.fa-phone {
color:#000;
font-size:25px;
display:inline-block;
position: absolute;
left: 78%;
top:29%;
}
.fa-phone:fullscreen{
display: none
}
'''
#media only screen and (min-width: 768px) { /* For desktop: */ .fa-phone{ display: none; }

How to change menu image when hovering over different links?

Let me start of by saying that I am new to this. I have some code from a template that I am using. On the menu drop down there is a list of the links to other pages and next to it is an image. What would I need to add to make the image change to another image when you hover over each of the links?
Here is the code.
<li class="menu-item-has-children megamenu">
<a href="#">
<span class="link-icon"></span>
<span class="link-txt">
<span class="link-ext"></span>
<span class="txt">
Equipment
<span class="submenu-expander">
<i class="fa fa-angle-down"></i>
</span>
</span>
</span>
</a>
<ul class="nav-item-children">
<li>
<div class="container megamenu-container">
<div class="vc_row row megamenu-inner-row bg-white p-0">
<div class="container ld-container">
<div class="row ld-row">
<div class="megamenu-column col-md-3 py-md-3 px-md-4">
<div class="megamenu-column-inner pl-md-4 py-md-4">
<ul class="lqd-custom-menu reset-ul font-size-15 lh-2 ltr-sp-025 font-weight-medium">
<li>
<i class="fa fa-angle-right mr-2"></i>Vertical Cartoners
</li>
<li>
<i class="fa fa-angle-right mr-2"></i>Horizontal Cartoners
</li>
<li>
<i class="fa fa-angle-right mr-2"></i>Pre Made Pouch Machines
</li>
<li>
<i class="fa fa-angle-right mr-2"></i>Case Packers
</li>
<li>
<i class="fa fa-angle-right mr-2"></i>Rigid Container Fillers
</li>
<li>
<i class="fa fa-angle-right mr-2"></i>Carton Sleeve Wrappers
</li>
</ul>
</div><!-- /.megamenu-column-inner -->
</div><!-- /.megamenu-column -->
<div class="megamenu-column col-md-3 bg-cover bg-center" data-responsive-bg="true">
<img class="invisible" src="./img/equipment/vertical-cartoner.jpg" alt="Megamenu Image">
</div><!-- /.megamenu-column -->
</div><!-- /.row ld-row -->
</div><!-- /.container ld-container -->
</div><!-- /.vc_row -->
</div><!-- /.megamenu-container -->
</li>
</ul>
</li>
I would use scripting for this kind of thing
$(document).ready(function(){
$('#op1').hover(function(){
$('#image').css('background-image','url("https://via.placeholder.com/150.png?text=op1")')
});
$('#op2').hover(function(){
$('#image').css('background-image','url("https://via.placeholder.com/150.png?text=op2")')
});
$('#op3').hover(function(){
$('#image').css('background-image','url("https://via.placeholder.com/150.png?text=op3")')
});
});
#image{
background-image: url("https://via.placeholder.com/150");
border: 1px solid black;
width: 150px;
height: 150px;
}
#op1, #op2, #op3{
padding: 5px;
cursor: pointer;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="image"></div>
<div id="op1">hover for op1</div>
<div id="op2">hover for op2</div>
<div id="op3">hover for op3</div>
Find this in your css stylesheet
.megamenu .link-icon {
...
}
Add the next lines right after it for a mouse-over effect. Sorry for the dots. For reason that your current css is unknown it is not possible to give the full solution.
.megamenu > a:hover .link-icon {
...
}

Best method for split screen layout when there's no unique container

I've to do a split screen layout (i.e. showing the content half on left, half on the right), but I'm having problems because there's not a unique container to hold the contents.
EDIT: Another possible solution is refactoring the HTML code to look like the standard cases for applying the split-layout.
Here is an image about how it should be.
I tried float, but seems not working.
.column-a_left {
position: relative;
float: left;
width: 50%;
}
.column-right1, .column-right2 {
position: relative;
float: left;
width: 50%;
}
<body>
<section class="section-a">
<header>
<div class="key-wrapper column-left">
<img src="https://imgur.com/a/ZzN8zkc" alt="a man with a key" class="key">
</div>
<div class="column-right1">
<svg width="120" height="35" class="logo" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path id="a" d="M.01.021h67.924V34.93H.01z"/> *numbers* </svg>
<div class="section-a__icons">
<i class="fab fa-twitter"></i>
<i class="fab fa-facebook-f"></i>
<i class="far fa-envelope"></i>
</div>
</div>
</header>
<div class="section-a_left-align column-right2">
<!-- content -->
<div class="wrapper-a">
Privacy Policy.
</div>
</div>
</section>
</body>
header {
display: flex;
width: 100%'
}
<header>
<div class="key-wrapper column-left">
<img src="img/illustration-main.svg" alt="a man with a key" class="key">
</div>
<div class="column-right1">
<svg width="120" height="35" class="logo" *numbers* </svg>
<div class="section-a__icons">
<i class="fab fa-twitter"></i>
<i class="fab fa-facebook-f"></i>
<i class="far fa-envelope"></i>
</div>
</div>
</header>
The element is containing the 2x columns, just use it as the parent element and apply your css needed there.

Adding margin-right % put last item in next row

I've a set of links of my footer. I want to put some extra spacing between each other, but now last item goes to the next line.
I think is important to note that I'm using Bootstrap 4, and that the Left Col is set to col-md-8 so there is enough space for the links.
Codepen
https://codepen.io/anon/pen/GaaJRm
Demo
ul>li {
display: inline-block;
/* You can also add some margins here to make it look prettier */
zoom: 1;
*display: inline;
/* this fix is needed for IE7- */
}
.footer_text {
font-size: 12px;
font-weight: bold;
letter-spacing: .2em;
padding: 0px;
margin: 0px;
}
.footer_nav_links {
margin-right: 2%;
}
.footer_icons {
font-size: 18px;
color: grey;
}
<div id="footer-navbar" class="container-fluid footer_text">
<div id="footer-navbar" class="container row footer navbar-fixed-bottom padding-top2 my-0 mx-auto padding-bottom2 ">
<div class="col-md-8">
<div class="">
<nav class="">
<div class="mx-auto d-sm-flex d-block flex-sm-nowrap">
<ul class="">
<li class="footer_nav_links">
<a class="" href="{% url 'shop:quienes_somos' %}">¿Quiénes somos?</a>
</li>
<li class="footer_nav_links">
<a class="" href="{% url 'shop:como_comprar' %}">¿Cómo comprar?</a>
</li>
<li class="footer_nav_links">
<a class="" href="{% url 'shop:contactanos' %}">Contáctanos</a>
</li>
</ul>
</div>
</nav>
<ul class="left footer-links footer-interact hidden-md-down">
<li><i class="fab fa-twitter footer_icons"></i></i></li>
<li><i class="fab fa-instagram footer_icons"></i></i></li>
<li><i class="fab fa-facebook-square footer_icons"></i></i></li>
<li><i class="fab fa-youtube footer_icons"></i></i></li>
</ul>
</div>
</div>
<div class="col-md-4 text-right">
<div class="">
<p><img src="{% static 'img/home/peru-flag.png' %}" width="40px" height="40px">Perú</p>
</div>
<div class="right footer-legal">
<span>© 2019 StickersGallito</span>
Privacy & Terms
</div>
</div>
</div>
</div>
</div>
</div>
Yes. The Left Col is set to col-md-8 and there is enough space. But the ul tag, which is the parent of all the footer_nav_links has a smaller width. You can add width: 100% for the ul tag to make its width equal to that of its parent which will open up space for the footer tags.
Modified Codepen
https://codepen.io/anon/pen/BeeNzY

Why isn't my line divider and buttons on small screen mobile devices in proportion?

I was wondering why my buttons in the jsfiddle below and my line divider shown below in my jsfiddle isn't in line like my text on a mobile device such as the iPhone. For example, the outline of the buttons go each over each other and the line goes to the right side more and isn't equal on the users screen. How can I stop this from happening and ensure each part of the content on my web page is responsive/in proportion to what screen the user is viewing my site on.
Website code
Here is an example screenshot below of what I'm talking about.
As you can see in the code below, I have used bootstraps col could I have picked the wrong size of the container could this be the issue?
<div class="header1">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="header-content">
<h1 class="maintxt rotateInUpLeft animated">LIAM DOCHERTY</h1>
<h3 class="subtxt rotateInUpLeft animated">WEB DEVELOPER & GRAPHIC DESIGNER</h3>
<hr class="content-divider">
<ul class="list-inline intro-social-buttons">
<li>
<i class="fa fa-linkedin fa-fw"></i> <span class="network-name">Web Development Portfolio</span>
</li>
<li>
<i class="fa fa-linkedin fa-fw"></i> <span class="network-name">GFX Design Portfolio</span>
</li>
<li>
<i class="fa fa-linkedin fa-fw"></i> <span class="network-name">About Me</span>
</li>
<li>
<i class="fa fa-linkedin fa-fw"></i> <span class="network-name">Contact Me</span>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
You set a fixed width for hr class in CSS
.content-divider {
border-top: 1px solid #f8f8f8;
border-bottom: 1px solid rgba(0,0,0,0.2);
width: 790px;
}
This breaks the line divider on small screens.
For the buttons add a padding
ul.intro-social-buttons li {
padding-bottom: 10px;
}
https://jsfiddle.net/jktsmruc/3/