there is a problem in fiting the page to mobile - html

i've done a simple hmtl site and wanted to make it responsive to mobile but i can't
ive tried a media code but still doesn't work idk what to do
can you help me
this is how it looks from mobile
and
this is my css
body{
margin: 0px;
display: inline;
align-self: center;
}
h1 {
font-family: cairo-bold;
text-align: center;
color: #697683;
}
h2 {
font-family: sky-bold;
text-align: center;
color: #1ba690;
}
.iinkor-box {
background-color: #f8f8f8;
height: 180px;
width: 180px;
display: inline-block;
margin-bottom: 15px;
margin-right: 8px;
margin-left: 8px;
}
.iinkor-box img {
width : 138px;
height: 108px;
display: inline-block;
padding: 10px;
}
.iinkor-box a {
color : #41978f;
font-size: 16px;
font-family: bein;
display: inline-block;
}
.iinkor-box img:hover {
opacity: 80%;
}
a:active {text-decoration: none}
a:visited {text-decoration: none}
a:hover {text-decoration: none}
a:link {text-decoration: none}
.iinkor-button {
background-color:#07439b;
border-radius:28px;
border:1px solid #1978ab;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:sky-bold;
font-size:17px;
padding:11px 18px;
text-decoration:none;
text-shadow:0px 1px 0px #284666;
}
.iinkor-button:hover {
background-color:#2a71bd;
}
.iinkor-button:active {
position:relative;
top:1px;
}
#media only screen and (max-width:800px) {
/* For mobile phones: */
.iinkor-box {
width:60%;
}
}
please if you edit the code tell me what to do also so i can know for the future
thank you in advance

Instead of trying to make it responsive only to mobile, consider that you app should be responsive to any screen size.
In the above css code the only rule that is "responsive" is the width: 60% everything else is pretty much static.
How is your HTML tree constructed? Where are the .iinkor-box container rules?
And more importantly, what is your desired effect?
Consider working with flexible patterns.
Start mobile first and then progressively enhance your code to achieve the desktop view.

Related

How can I get the spacing right please?

I'm not the greatest with HTML, but I'm also not the worse, as in I know how to locate and change things with instructions, but that's about it.
Is anyone able to help me please?
I am trying to get these two menu's separated/spaced out, ideally the main menu links to the left, and the social media links to the right, I have included two images below that hopefully explains what I'm looking to achieve.
This is how it looks on my site
This is how I want it to look
Hopefully I have put the right bit of code below, as I initially said I'm not great with HTML at all.
# 7. Navigation
-----------------------------------------------*/
#social-menu .social-links a {
color: $(topmenu.text.color);
}
#social-menu .social-links a:hover {
color: $(topmenu.text.hover.color);
}
.menu-wrap {
font-family: 'Poppins', sans-serif;
font-weight: 400;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 2px;
width: 100%;
z-index: 7;
word-break: break-word !important;
-webkit-font-smoothing: subpixel-antialiased;
text-align: center;
}
#menu-secondary {
max-width: 1180px;
margin: 0 auto;
border-top: 1px solid;
border-bottom: 1px solid;
}
#nav-secondary {
margin-bottom: 50px;
}
#nav-primary {
position: static;
height: 50px;
background: $(topmenu.bg.color);
}
.wrapper-nav-primary {
max-width: 92%;
margin: 0 auto;
position: fixed;
width: 100%;
background: $(topmenu.bg.color);
padding: 0 4%;
z-index: 999;
}
#menu-primary {
width: 70%;
float: left;
visibility: hidden;
}
#social-menu {
float: right;
margin-top: 18px;
}
.menu-wrap .widget {
display: inline-block;
}
.menu-wrap li {
display: inline-block;
position: relative;
}
.menu-wrap li,
.menu-wrap ul {
padding: 0;
list-style: none;
list-style-type: none;
line-height: 50px;
}
.menu-wrap li a {
margin: 0 30px;
font-weight: 400 !important;
}
#nav-primary li a {
color: $(topmenu.text.color);
}
#nav-primary li a:hover {
color: $(topmenu.text.hover.color);
}
Thank you in advance.
My guess is that you can add the following to the #social-menu. If you can supply the HTML implementation, and not only the CSS it will be easier to determine.
position: absolute;
right: 0px;
Thank you both again for your help, I feel very silly as the solution was simply going to the Blogger layout section and simply moving a box!
I spent the whole of yesterday trying to sort this, following various tutorials and guides changing the HTML and adding CSS haha.
The red HTML/JavaScript box in the primary menu section should be in the social media section below

Move over responsive nav bar text

Just starting out with some more css, using the examples on w3schools to make a responsive nav bar. I got part of it moved to where I want (the icon for when the screen is smaller) but I can't figure out how to move the actual nav bar text.
Not entirely sure what I should do, tried a couple things but with my limited knowledge things go all wonky. Im pretty sure I know where the edit would take place, if Im right it would take place in this part of the css
.navbar.responsive a {
float: right;
display: block;
text-align: left;
}
Heres the full css
#charset "UTF-8";
/* CSS Document */
body {
font-family: Arial, Helvetica, sans-serif;
}
.navbar {
overflow: hidden;
float: right;
margin-top: 50px;
margin-right: 50px;
}
.navbar a {
display: block;
float: left;
font-size: 16px;
color: black;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.navbar .icon {
display: none;
}
.dropdown {
float: left;
overflow: hidden;
}
.dropdown .dropbtn {
font-size: 16px;
border: none;
outline: none;
color: black;
padding: 14px 16px;
background-color: inherit;
font-family: inherit;
margin: 0;
}
.navbar a:hover, .dropdown:hover .dropbtn {
background-color: red;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #C58485;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #ddd;
}
.dropdown:hover .dropdown-content {
display: block;
}
#media screen and (max-width: 600px) {
.navbar a, .dropdown .dropbtn {
display: none;
}
.navbar a.icon {
float: right;
display: block;
position: absolute;
top:10px;
right: 45%;
}
}
#media screen and (max-width: 600px) {
.navbar.responsive {position: static;}
.navbar.responsive .icon {
float: right;
display: block;
top:10px;
right: 45%;
}
.navbar.responsive a {
float: right;
display: block;
text-align: left;
}
.navbar.responsive .dropdown {float: none;}
.navbar.responsive .dropdown-content {position: absolute;}
.navbar.responsive .dropdown .dropbtn {
display: block;
width: 100%;
text-align: left;
}
}
Basically what its doing is when Im in a smaller window and the responsive page pops up, I want the text to be centered and in a line straight across when you click the 3 line dropdown.
Proof of concept: https://imgur.com/a/Ho5JENI
What it does right now: https://imgur.com/a/j2oWwlm
Here is a basic responsive navbar example hope this helps
EDIT
Explanation: inherently most elements in HTML are block level elements meaning that they stack on top of each other. An Anchor or "a" tag is an inline element meaning they will stay on the same line with other inline elements. In most cases you should start by framing out your page (just using HTML) this will allow you to see which elements stack on top of each other (block elements). If most of your elements stack that means they will easily fit on a small screen (mobile device). I can see you have a media query so I wont waste your time explaining that so... once you have the real estate (tablet or desktop) you then want to make some of your block elements inline, inline-block or float them depeding on how you want them to react with the other elements beside them. The easiest way (in this case) is to use flexbox which is great for laying out objects in 2D space. W3Schools: More information on flexbox here From there it is all visual and experience preference. Please let me know if you have any questions comments or concerns in the comments, I will be more than happy to help you. Good Luck and Keep Coding
nav {
display: flex;
flex-direction: column;
align-items: center;
}
ul {
list-style: none;
text-align: center;
margin: 0;
padding: 0;
}
#media only screen and (min-width: 768px) {
ul {
display: flex;
}
li a {
padding: 1rem;
}
}
<nav>
<button>☰</button>
<ul>
<li><a href="#">home<a></li>
<li><a href="#">about<a></li>
<li><a href="#">portfolio<a></li>
<li><a href="#">prints<a></li>
<li><a href="#">contact<a></li>
<ul>
<nav>

failing to make portfolio responsive

i coded my portfoliowebsite myself and my code probably is a mess because i don't have that much experience with code.
The problem i'm having is to make the website responsive so it's also looking good on the phone.
I think the problem is that i used px instead of %, but i tried various stuff and it doesn't look like i want. The website is https://www.jessewensing.com
I'll post a part of the code.
.content {
width: calc(100vw - 30%);
position: relative;
left: 30%;
margin-top: -6%;
}
.menu-header {
font-family: 'Akkurat';
text-align: left;
}
.project-nav {
margin-top: 20px;
font-family: 'Akkurat';
}
img {
cursor:s-resize;
-webkit-filter: drop-shadow(5px 5px 5px #A9A9A9);
filter: drop-shadow(5px 5px 5px #A9A9A9);
top:-2%;
margin-top: 10%;
width:50%;
}
ul {
list-style-type: none;
text-align: left;
left:3%;
margin-left: 0;
padding: 0;
position: fixed;
}
a {
text-decoration: none;
color: black;
color:red;
}
p {
top: 10px;
right:3%;
font-family: 'Akkurat';
position: fixed;
z-index: 2;
}
p.naam {
top:10px;
left:3%;
font-family: 'Akkurat';
position: fixed;
}
p.contact {
top:76%;
left:3%;
font-family: 'Akkurat';
position: fixed;
}
p.cv {
top:80%;
left:3%;
font-family: 'Akkurat';
position: fixed;
}
p.text {
margin-top: 106px;
right:3%;
font-family: 'Akkurat';
color:red;
}
</style>
This is how i want it to look when using the phone
https://jsfiddle.net/f51xjnzu/
Making the website responsive occurs mainly in the stylesheet (css), using % will help instead of px or em, wrap your elements in div containers to help keep elements align when accessed from a smaller device/screen.
You will have to resize certain elements or even hide them at specific screen sizes using similar code to below:
#media
only screen
and (min-width : 1024px) {}
Check this website for more details:
https://seesparkbox.com/foundry/structuring_a_responsive_stylesheet
Hope this helps, good luck!

HTML Responsiveness not working

I'm facing issue for responsiveness using DreamWeaver 2017.
The CSS for the logo :
#logo {
margin-left: 6cm;
padding-top: 40px;
padding-bottom: 10px;
/*width: 139px;*/
text-align: left;
color: rgba(255,255,255,1.00);
}
Upon trying out the responsiveness :
I'm aware i'm using margin left which caused it.
The objective is to adapt both site and mobile site like this :
Also, if you observed even the input box also indent to the right..
.menu2 {
display: inline-flex;
text-decoration:none;
margin-left: 1.2cm;
color: #000000;
height: 40px;
}
I'm looking on other method than padding or margin.
Any critic/suggestion is welcome.
HTML codes:
<header>
<!-- This is the header content. It contains Logo and links -->
<div id="logo"><img src="logo.png" alt="sojologo"/>
<font color="black" class="menu1">ABOUT</font>
<button id="logodropdown"><img src="dropdown_arrow.png"/></button>
SIGN IN/<br>REGISTER
PROMOTIONS
TRAVEL<button id="logodropdown"><img src="dropdown_arrow.png"/></button>
<div class="menu2" style="border: 3px solid #DDD;">
<img src="icon_search.png"/>
<input size="50%" placeholder="Quick Search for any city or
street in Japan" style="border:none;"/>
</div>
</div>
</header>
Codepenio : https://codepen.io/jayvicious/pen/xrxbZz
There is a lot going on here that we can look at. One thing others have commented on is that your HTML needs cleaned up. Make sure that IDs are truly unique, and that each opening tag has a closing tag (except for self-contained elements, like images and inputs).
You could also stand to use some wrapping elements to help you contain the main areas of your header: the logo, the nav items, and the search.
From there, to help with responsiveness, I would recommend using percentages for your widths whenever possible, instead of absolute units like centimeters. This will help your display flex a little bit at bigger screen sizes. At some point, though, you'll need to just redo the layout because the screen will be too wide to fit all your elements in one line. That's where media queries come into play.
Media queries will let you override a base style when the screen is smaller (or larger) than a certain width. For example, we could set the body to be blue normally, then change to red on smaller screens:
body {
background-color: blue;
}
#media all and (max-width: 800px) {
body {
background-color: red;
}
}
Another thing we can do to tidy things up and make our life easier is to use classes when possible. The nav items are a good use case for this: most of their styles will be shared. We can give them each an ID just in case, but we may not even need to use all those IDs.
Edit: Another tidying opportunity I meant to mention is that the use of the <font> tag is deprecated as of HTML5, so you should avoid that in your HTML. I removed it from the HTML in my snippet below. (End edit.)
A final thing you can do is make the little triangles next to the nav items with HTML and CSS instead of as images. (You could also do these purely in CSS using pseudo elements.)
Here is a demo where I've cleaned up your HTML quite a bit and then heavily revised the CSS to look more like what's in the pictures you provided. I have used placeholder images with my best guess at their real sizes based on the picture. You'll see that as you resize the screen, the media queries kick in to make the header get taller and to center things in the middle of the screen.
I've also forked your Pen on CodePen.
#charset "utf-8";
/* Global Styles */
a:hover {
color: rgba(255,255,255,1.00);
}
body {
margin: 0;
}
header {
font-family: 'Montserrat', sans-serif;
color: rgba(146,146,146,1.00);
background-color: #73A7D1;
font-size: 14px;
font-style: normal;
font-weight: 400;
width: 100%;
height: 80px;
}
#header-wrapper {
width: 80%;
margin: 0 10%;
padding-top: 15px;
}
#logo, nav, #search {
float: left;
}
#logo {
width: 110px;
height: 50px;
}
nav {
width: 60%;
}
#search {
width: 200px;
}
.menu-item {
display: inline-block;
margin: 0 2.5%;
height: 30px;
color: black;
max-width: 100px; /* forces "sign in/register to break at <wbr> tab */
text-align: center;
}
#menu2 {
position: relative; /* bump "sign in/register" down a bit */
top: 7px;
}
.triangle-down { /* dropdown arrows next to nav links */
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid black;
display: block;
float: right;
margin-top: 5px;
margin-left: 3px;
}
#search img, #search input {
float: left;
height: 30px;
}
#search img {
margin-right: 5px;
}
#search input {
width: 150px;
}
#media all and (max-width: 980px) {
header {
height: 160px;
}
#logo, nav, #search {
float: none;
margin: 0 auto;
}
nav {
width: 100%;
text-align: center;
}
}
#media all and (max-width: 550px) {
header {
height: 200px;
}
}
<header>
<div id="header-wrapper">
<div id="logo"><img src="http://placehold.it/110x50" alt="sojologo"></div>
<nav>
<div class="menu-item" id="menu1">ABOUT<span class="triangle-down"></span></div>
<div class="menu-item" id="menu2">SIGN IN/<wbr>REGISTER</div>
<div class="menu-item" id="menu3">PROMOTIONS</div>
<div class="menu-item" id="menu4">TRAVEL<span class="triangle-down"></span></div>
</nav>
<div id="search">
<img src="http://placehold.it/30x30"/>
<input placeholder="Quick Search for any city or street in Japan" />
</div>
</div>
</header>
well FreedomPride
you can specify different properties for every class in each size of screens
you can use media query in this situation.
for example :
#media only screen and (max-width: 480px) {
.menu2 {
margin-left:20px;
}
}
as you see here I changed the margin in small screens 480px wide to 20px
and you can use it for each size
320px
480px
720px
1200px
you may get more information for mediaquery from here :
https://www.w3schools.com/css/css_rwd_mediaqueries.asp
here's example of how we can do it :
#charset "utf-8";
/* Global Styles */
a:hover {
color: rgba(255,255,255,1.00);
}
/*header*/
header {
font-family: 'Montserrat', sans-serif;
color: rgba(146,146,146,1.00);
font-size: 16px;
font-style: normal;
font-weight: 400;
}
#menu1 {
display: inline-block;
margin-left: 3cm;
margin-right: auto;
height: 30px;
}
.menu2 {
display: inline-flex;
text-decoration:none;
margin-left: 1.2cm;
color: #000000;
height: 40px;
}
/* Logo placeholder*/
#logo {
margin-left: 6cm;
padding-top: 40px;
padding-bottom: 10px;
/*width: 139px;*/
text-align: left;
color: rgba(255,255,255,1.00);
}
#logodropdown {
margin-left: 0px;
border: none;
background-color: rgba(255,255,255,1.00);
}
/* div for Links in header */
#headerLinks {
float: left;
width: calc( 100% - 139px );
text-align: right;
padding-top: 10px;
padding-bottom: 10px;
background-color: rgba(255,255,255,1.00);
}
/* Links in header */
#imgContainer{
float:left;
}
#headerLinks a {
text-decoration: none;
color: rgba(146,146,146,1.00);
padding-left: 66px;
font-size: 14px;
}
/* Offer text banner*/
#offer {
font-family: 'Montserrat', sans-serif;
clear: both;
background-color: rgba(246,246,246,1.00);
color: rgba(146,146,146,1.00);
padding-top: 57px;
padding-bottom: 57px;
}
#media only screen and (max-width: 1366px) {
#logo {
margin-left: 1cm;
padding-top: 40px;
padding-bottom: 10px;
/*width: 139px;*/
text-align: left;
color: rgba(255,255,255,1.00);
}
#media only screen and (max-width: 1366px) {
#logo {
margin-left: 1cm;
padding-top: 40px;
padding-bottom: 10px;
/*width: 139px;*/
text-align: left;
color: rgba(255,255,255,1.00);
}
#media only screen and (max-width: 1280px) {
#logo {
margin-left:30px;
}
#menu1 {
margin-left:35px;
}
.menu2 {
margin-left:20px;
}
.menu2 input {
max-width:300px;
}
}
#media only screen and (max-width: 992px) {
#logo {
margin-left:25px;
}
#menu1 {
margin-left:25px;
font-size:18px;
}
.menu2 {
margin-left:15px;
font-size:14px;
}
.menu2 input {
max-width:250px;
font-size:11px;
}
#media only screen and (max-width: 720px) {
#logo {
margin-left:10px;
}
#menu1 {
margin-left:10px;
font-size:13px;
}
.menu2 {
margin-left:5px;
font-size:10px;
}
.menu2 input {
max-width:150px;
font-size:10px;
}
}
<header>
<!-- This is the header content. It contains Logo and links -->
<div id="logo"><img src="logo.png" alt="sojologo">
<font color="black" id="menu1">ABOUT</font>
<button id="logodropdown"><img src="dropdown_arrow.png"></button>
SIGN IN/<br>REGISTER
PROMOTIONS
TRAVEL<button id="logodropdown"><img src="dropdown_arrow.png"></button>
<div class="menu2" style="border: 3px solid #DDD;">
<img src="icon_search.png"/>
<input size="50%" placeholder=" Quick Search for any city or street in Japan" style="border: none;"/>
</div>
Notice: This isn't the best practice. but for more efficient you have to use any grid system or framework like bootstrap, foundation or uikit.
I think you should check for media rules to get full responsiveness in any width/height you want.

Webpage displays differently on different screens

I'm trying to get my website to be display the way that it was designed. I have an iMac but when I view it on a MacBook Pro and my phone, the divs on one of my pages lose their proportions and it's not looking the way it should. Here's the link to my page:http://www.wintonbrownmusic.online/Music%20Site%20Beat%20Making.html
Here's the CSS for my page:
header, section, footer, aside, nav, main, article, figure {
display: block;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
a {
display: inline-block;
width: 90px;
text-align: center;
text-decoration: none;
font-family: Gagalin;
color: #404040;
font-size: 20px;
}
li {
width: 100px;
margin: auto;
display: inline;
}
p {
font-family: Arial;
padding-left: 10px;
}
a:hover, a:active {
padding-bottom:8px;
background: transparent;
border-bottom: 3px solid #FA8440;
}
a:active {
color: #FA8440;
}
.newspaper {
-webkit-columns: 100px 3; /* Chrome, Safari, Opera */
-moz-columns: 100px 3; /* Firefox */
columns: 100px 3;
font-family: Arial;
}
h2 {
font-family: Gagalin;
padding-left: 10px;
}
footer {
background-color:black;
color:white;
clear:both;
text-align:center;
padding:5px;
}
.blurb {
margin:5px 0 10px 10px;
width:425px;
height: 230px;
background:#1a1a1a;
border: 6px solid #4d4d4d;
padding: 30px;
float: right;
font-family: Arial;
color: White;
padding-right:50px;
}
.container-fluid {
margin: 0 auto;
margin-left: 0 auto;
width: 65%;
}
I could use some assistance on what code I can use to make this page appear the same in all browsers, all pages and even phones.
Its a resolution problem(or cross browser issue) since I see your fixing width and height in ur css.
There are 2 Solutions to ur problem:
make your containers/divs by percentage, even after doing that you may still face some issues.
What I would recommend is scrap existing html and redo it using a styling framework like bootstrap(http://getbootstrap.com/) this would allow you to make your website responsive and it wont break on different browsers.
The problem is that the design is not responsive (does not naturally adjust to different screen sizes and formats). Responsive design is a huge topic that can't really be covered in the contents of once conversation box, so I am adding some links for you to look at.
Responsive web design basics:
https://developers.google.com/web/fundamentals/design-and-ui/responsive/
Media queries:
https://www.w3schools.com/css/css_rwd_mediaqueries.asp