Weird div block - html

I have a question about this: https://gyazo.com/1851299f16c3148c81f8e83682d38ff1
https://gyazo.com/05adf6012ba98bbae93ecda4dabbdffa
It can be a stupid question or just a stupid code. But how can i get that long block away? My logo is scaled and correct. But if i delete that long div block, then the logo unscaled, and be big.
Need advice.
Thankyou!

I created a few examples on jsfiddle for you.
1)
To get rid of the black bar you could do something like this:
<div class="wrapper">
<div class="Logo">
<img class="LogoNav" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/9front_logo.svg/150px-9front_logo.svg.png">
</div>
<li>Home</li>
<li>Over</li>
<li>Contact</li>
<li>bestellen</li>
</div>
example:
https://jsfiddle.net/x4912b7s/1/
2)
To move the links to the right of the logo, but still inside the black box:
.LogoNav {
width: 25%;
height: auto;
float: left;
}
example: https://jsfiddle.net/x4912b7s/2/
3) To remove the black box and move the links next to the logo:
html
<div class="wrapper">
<div class="Logo">
<img class="LogoNav" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/9front_logo.svg/150px-9front_logo.svg.png">
</div>
<li>Home</li>
<li>Over</li>
<li>Contact</li>
<li>bestellen</li>
</div>
css
.LogoNav {
width: 25%;
height: auto;
float: left;
}
example: https://jsfiddle.net/x4912b7s/3/
Hopefully this helps.

Related

Position 4 Images Vertically Responisively No Padding

I just want to thank everyone for being so helpful, I would of never learnt so much if it wasn't for your guys continual helpfulness.
I'm trying to make a 4 way vertical "collage" of some images without spaces between each picture that is fully responsive when resizing the window and such. The problem I'm having is with space between each photo; I'm trying to figure out how to allow no space between each.
I also encounter a problem when resizing the window to be smaller in which the images flow away from the lion image above and make more white space or padding without sticking to the lion image. It also starts to overlap the lion image when resizing to a bigger size.
.image {
background-image: url(https://s-media-cache-ak0.pinimg.com/originals/31/91/d7/3191d75f03ba7d4c570358870c855ed7.jpg);
background-repeat: no-repeat;
height: 850px;
background-size: 100%;
}
#collage {
width: 90%;
}
<div class="image">
<ul id="nav">
<li id="brand">MINIMAL</li>
<li id="navm">Men</li>
<li id="navm">Women</li>
<li id="navm">Contact</li>
</ul>
<h1>Simplicity is Minimal</h1>
<div id="home">
Shop Now
</div>
</div>
<div class="row">
<div class="col-md-3" align="center">
<img id="collage" src="https://upload.wikimedia.org/wikipedia/commons/2/27/Panthera_tiger_in_a_marshy_area_in_captivity.jpg">
</div>
<div class="col-md-3" align="center">
<img id="collage" src="https://upload.wikimedia.org/wikipedia/commons/2/27/Panthera_tiger_in_a_marshy_area_in_captivity.jpg">
</div>
<div class="col-md-3" align="center">
<img id="collage" src="https://upload.wikimedia.org/wikipedia/commons/2/27/Panthera_tiger_in_a_marshy_area_in_captivity.jpg">
</div>
<div class="col-md-3" align="center">
<img id="collage" src="https://upload.wikimedia.org/wikipedia/commons/2/27/Panthera_tiger_in_a_marshy_area_in_captivity.jpg">
</div>
</div>
You need to just add below css and I hope it works.-
*{
margin:0px;
padding:0px;
}
.image {
height: auto;
}
body img {
display: block;
}`

Layering Objects || Google Map & Nav Bar

I'm trying to make an interactive google map page but I'm having a bit of trouble layering the divs.
My html looks something like this
<body>
<div class="wrapper">
<div class="header">
<p class="logo"> Put a logo here later </p>
</div>
<div class="nav">
<ul>
<li> link 1 </li>
<li> link 2 </li>
<li> link 3 </li>
</ul>
</div>
<div class="content">
<div class="main">
<h1>Google Maps</h1>
<div id="map"></div>
</div>
</div>
<div class="footer">
<p> Put a footer down here later </p>
</div>
</div>
and the related css looks like this
#map{
position: absolute;
overflow: hidden;
left: 0px; top: 0px;
height: 100%;
width: 100%;
z-index: 0;
}
.nav{
background-color: #fff;
width: 120px;
height: 500px;
z-index: 100;
}
What happens at the moment is the map takes the entire page (intentional) but I want the nav bar to float on top somehow. Any help would be appreciated. Thanks!
Simply add position:absolute; to your .nav
jsBin demo
that was to answer your last question (float nav bar on top of map somehow).
If you want everything to be over the map... do it this way:
<body>
<div id="map"></div>
<div id="everythingElse"><!--all other content--></div>
</body>
setting #everythingElse also to position: absolute;
Example: http://jsbin.com/xanen/3/edit

Floating Main Menu To Right of Site Name

Hello i seem to be having a little trouble doing the simplest of tasks tonight. Trying to make my primary-menu float to the right of my site site-name.
<header>
<div id="header">
<div class="g3">
<h1 id="site-name">
</div>
</div>
<div class="cf"></div>
</header>
<nav>
<div id="primary-menu" class="g3 nav">
<ul id="main-menu" class="menu links clearfix">
</div>
</nav>
<div class="cf"></div>
I dont know if i should be pasting in CSS code to help ut there seems too much from what i can gather. Your welcome to pop in and have a look. dont mind the mess.
Thanks
Add this style to header tag:
header {
width: 110px;
float: left;
}
and this to your nav:
nav {
float: left;
width: 800px;
margin: 10px;
}

Link my Logo to homepage html

I want to make my Logo in my header clickable and link to the homepage but i don't know exactly how to do this right.
My code:
Navigation menu:
HTML
<div id="myMenu">
<div class="myWrapper">
<nav>
<div class="logo"></div>
</nav>
</div>
</div>
CSS
#myMenu
{
width: 100%;
height: 30px;
z-index: 999;
background-color: #252e30;
}
.myWrapper
{
max-width: 660px;
margin: 0 auto;
}
.logo
{
display: inline-block;
width: 156px;
height: 30px;
margin-top: 5px;
background-size: auto 43px;
background-image: url(../images/mylogo.png);
background-repeat: no-repeat;
}
I want my logo make clickable and link to the page: Homepage.cshtml
Instead of using CSS to set your logo as a background image, what would be wrong with using the img tag, surrounding by a link? Like so:
<div id="myMenu">
<div class="myWrapper">
<nav>
<img src="../images/mylogo.png" height="30" width="156" />
</nav>
</div>
</div>
This has the added benefit of being more accessible (especially if you use an alt attribute on your logo), which makes search engine bots happier. Image content that conveys meaning to the user should never bet set using CSS.
You better use an image wrapped in an anchor-tag.
But else this should work:
<div class="logo" onclick="window.location.href='homepage.html'"></div>
You can't make a background image a link. Move the image into the HTML code, and then make that a link.
<div id="myMenu">
<div class="myWrapper">
<nav>
<div class="logo"></div>
</nav>
</div>
</div>
also it can be like following example:
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: #000000;">
<div class="logo" >
<a href="{% url 'major' %}">
<img src="{% static 'images/logo.gif' %}" style="width:80px;height:80px;"/>
</a>
</div>
.....
</nav>
Use an <a> instead of the <div> for the logo..

how can i position text to either side of an image in html5

I am trying to modify the HTML5 Boilerplate header to have a central image with a word either side like so:
as you can see I managed to do it, this was however only using parts of boilerplate and bad css that broke h5bp's usefulness. I would like to utilize h5bp correctly now and achieve the same thing. I'm just not sure how to do it.
My current attempt looks like this:
The image is not in between the words, even tho the order in the mark up is like so:
<div id="header-container">
<header class="wrapper clearfix">
<div class="center">
<h1 id="title">First</h1> <img src="img/mf_coffee_cup.png" alt="" height="280" width="340" /> <h1 id="title">Second</h1>
</div>
<nav>
<ul>
<li>Home</li>
<li>Blog</li>
<li>Contact</li>
</ul>
</nav>
</header>
</div>
Relevant CSS:
.center { display: table; margin: 0 auto; }
#title
{
padding: 20px;
display: inline;
font-size: 4.5em;
border-top: 4px solid #5dc1c4;
border-bottom: 4px solid #5dc1c4;
}
If anyone could explain why the text is not either side of the image that would be greatly appreciated.
Thank you
Edit:
While the answer below is valid I actually solved this problem by putting the < img > into the < h1 > instead of having them separated, like so:
<h1 id="title">First <img src="img/mf_coffee_cup.png" alt="" height="280" width="340" /> Second</h1>
With your HTML and just this CSS, the three items will display together on one line:
.center h1 {display: inline;}​
Working demo: http://jsfiddle.net/jfriend00/yK7Qy/
FYI, I notice that you're using the same id="title" in multiple places. That won't work for you because a given id can only be present on one object in the page. You probably want to change that to class="title".
It may be easier to just put all the text and image in one <h1> tag like this:
<div id="header-container">
<header class="wrapper clearfix">
<div class="center">
<h1>
<span class="title">First</span>
<img src="http://photos.smugmug.com/photos/344291068_HdnTo-Ti.jpg" alt="" />
<span class="title">Second</span>
</h1>
</div>
</header>
</div>​
Demo here: http://jsfiddle.net/jfriend00/CHv4k/
Try using display:inline-block; rather than display:inline. I don't have the project in front of me so I'm not sure of this will work.
However, if it does the image will be in the wrong spot. You must simply use vertical-align or margin-top:-##px.
A slightly different approach, using spans, and only one h1 tag:
<div id="header-container">
<header class="wrapper clearfix">
<div class="center">
<h1 class="title">
<span>First</span>
<img src="http://photos.smugmug.com/photos/344291068_HdnTo-Ti.jpg" alt="" />
<span>Second</span>
</h1>
</div>
</header>
</div>​
And I also changed some of the CSS:
.center h1 {display: block; }
// Add vertical align to the image, rather than the h1
.center img {margin: 0 10px; vertical-align: middle;}
Fiddle here
​