I'm creating and designing a mini social networking website for our school's Science Fair, and I already have a problem at the designing stage. :(
So I've created a few PSDs on how my website should look like, but it seems harder to translate my designs into HTML/CSS. My current trouble right now is this navigation bar that isn't cooperating with me...
In short, this navigation bar is very simple; the logo, with the title, a subtitle, and a few menu options (Login, Sign up). I'm using float:right; to float my options to the right, but that isn't working very well.
The options of my navigation bar are jutting out, below the Navigation Bar. It's really odd; when I take out the float:right; it seems perfectly fine, but is to the left. I would really like it to be on the right side.
A sample of the website is available at http://ticktalk.me.pn/. A PSD of the Sign-Up Page is available here: http://img1.imagilive.com/0314/tickTalk-signup.jpg.
Please feel free to "View Page Source" and investigate what I've done wrong. A direct link to the css is available at http://ticktalk.me.pn/css/style.css.
Thanks in advance.
EDIT:
This is my Navigation Bar HTML...
<div class= "navbar-header">
<div class= "navbar-title"><a href= "#">
tick<span class= "bookfont">talk</span>
</a></div>
<div class= "navbar-subtitle">
social networking around the clock
</div>
<div class= "navbar-menu">
<div class= "navbar-option login-button">
Login
</div>
<div class= "navbar-option navbar-checked signup-button">
Sign Up
</div>
</div>
</div>
and this is my CSS:
.navbar-header {
display:block;
background-color: rgb(0, 241, 73);
padding:10px;
margin-bottom:75px;
}
.navbar-logo {
display:inline-block;
}
.navbar-title {
display:inline-block;
font-size: 52px;
margin-left:10px;
margin-right:5px;
}
.bookfont {
font-weight: 500;
}
.navbar-subtitle {
display:inline-block;
font-size: 30px;
}
.navbar-menu {
float:right;
}
.navbar-option {
display:inline-block;
font-size:25px;
padding:20px;
padding-left:30px;
padding-right:30px;
}
.navbar-checked {
background-color: rgb(0, 217, 63);
}
Put the element with that has "float: right" before the rest of the elements on that line.
Basically, move <div class="navbar-menu">...</div> before <img src="logo.png" ...>.
Or, in the sample code of the edited question, move <div class="navbar-menu">...</div> before <div class="navbar-title">...</div>.
I am not sure regarding the technical justification to this, but floats are better put before the non floats.
Perhaps this is because it assumes there is no room for the floating element.
Try elements on the left side wrapping with another div. Like this for example:
<div class="navbar-header">
<div class="another-div">
<img src="logo.png" alt="logo.png" class="navbar-logo" width="47" height="47">
<div class="navbar-title">
tick<span class="bookfont">talk</span>
</div>
<div class="navbar-subtitle">
social networking around the clock
</div>
</div>
<div class="navbar-menu">
<div class="navbar-option login-button">
Login
</div>
<div class="navbar-option navbar-checked signup-button">
Sign Up
</div>
</div>
</div>
Then give that .another-div CSS property float:left, and don't forget to set a hight for the .navbar-header after this.
.another-div{
float: left;
}
.navbar-header{
height: 80px;
}
This should work.
Related
I am trying to develop a Help me function for our users. For this purpose, I am trying to put a div right above my footer. But, my div styling is affecting the footer, and I am not able to figure out why.
The look I am trying to achieve -
How it looks when I try to implement -
My styling affects the footer styling.
Here is my html code
<div class="help-img pull-right">
<a href="https://google.com">
<img src="~/Content/images/icon-help.png?version=#buildVersion" />
</a>
</div>
<footer class="clearfix">
<div class="pull-left">
<span id="footerYear"></span> © VMS Web #ViewContext.Controller.GetType().Assembly.GetName().Version
</div>
<div class="pull-right">
VMS Web User Guide |
Terms of Use
</div>
</footer>
My CSS -
.help-img {
position: relative;
bottom: 50px;
margin-right: 28px;
}
Any help is appreciated. Thanks
You need to wrap your elements to be able to position them relatively. Or you can use flexbox layout model, which is more suitable in this case.
.wrapper{
display:flex;
flex-direction:column;
}
.help-img {
margin-right: 28px;
align-self:flex-end;
margin-bottom:5px;
background-color:#f1f1f1;
}
.clearfix{
display:flex;
justify-content:space-between;
background-color:#f1f1f1;
}
<div class="wrapper">
<div class="help-img pull-right">
<a href="https://google.com">
<img src="~/Content/images/icon-help.png?version=#buildVersion" />
</a>
Need Help? <strong>Click Here</strong>
</div>
<footer class="clearfix">
<div class="pull-left">
<span id="footerYear"></span> © VMS Web #ViewContext
</div>
<div class="pull-right">
VMS Web User Guide |
Terms of Use
</div>
</footer>
</div>
I'm having trouble figuring out why my links are not scrolling to the correct position. They are scrolling to the section below where they should. I've looked at all the examples I could find to no avail.
<div class="bottomarea">
<div class="bottomareatitles">IDX Website Features</div>
<div class="bottomareasubtitle">WeeboWeb real estate websites have all the tools you need to market yourself and grow your business online. Effective, professional designs that connect you with 32% more buyers and sellers. </div>
<div id="iconcontainer">
<div class="bottomareaicons"><i class="fa fa-laptop" aria-hidden="true"></i><br>Effective Designs</div>
<div class="bottomareaicons"><i class="fa fa-hourglass-half" aria-hidden="true"></i><br>Quick Setup</div>
<div class="bottomareaicons"><i class="fa fa-users" aria-hidden="true"></i><br>Lead Capture</div>
<div class="bottomareaicons"><i class="fa fa-map-marker" aria-hidden="true"></i><br>Map Search</div>
<div class="bottomareaicons"><i class="fa fa-mobile" aria-hidden="true"></i><br>Mobile Friendly</div>
<div class="bottomareaicons"><i class="fa fa-facebook" aria-hidden="true"></i><br>Social Media</div>
<div class="bottomareaicons"><i class="fa fa-comments" aria-hidden="true"></i><br>Blogging</div>
<div class="bottomareaicons"><i class="fa fa-pencil" aria-hidden="true"></i><br>Branding</div>
</div></div>
<div class="bottomsection">
<div class="section">
<h1><a id="effectivedesigns">Effective Designs</a></h1>
<p>sample content</p></a>
</div>
<div class="section">
<h1><a id="quicksetup">Quick Setup</a></h1>
<p>sample content</p>
</div>
<div class="section">
<h1><a id="leadcapture">Lead Capture</a></h1>
<p>sample content</p>
</div>
<div class="section">
<h1><a id="mapsearch">Map Search</a></h1>
<p>sample content</p>
</div>
<div class="section">
<h1><a id="mobilefriendly">Mobile Friendly</a></h1>
<p>sample content</p>
</div>
<div class="section">
<h1><a id="socialmedia">Social Media</a></h1>
<p>sample content</p>
</div>
<div class="section">
<h1><a id="blogging">Blogging</a></h1>
<p>sample content</p>
</div>
<div class="section">
<h1><a id="branding">Branding</a></h1>
<p>sample content</p>
</div></div>
Here's the CSS
.bottomarea {display:block; width:100%;}
.bottomareatitles {text-align:center; margin-top:50px; font-size:26px; color:#000000; font-weight:350;}
.bottomareasubtitle {text-align:center; padding-top:20px; color: dimgrey; width:75%; margin:auto;}
.bottomareaicons {width:130px; display:inline-block; margin:auto; text-align:center; margin-top:40px; color:#000000; font-size:16px; padding-bottom:10px; padding-top:10px;}
.bottomareaicons:hover {width:130px; display:inline-block; margin:auto; text-align:center; margin-top:40px; color:#000000; font-size:16px; background:#2584b8; padding-bottom:10px; padding-top:10px;}
.bottomareaicons i {font-size:3.0em; padding-bottom:20px; color:#2584b8;}
.bottomareaicons:hover > i {font-size:3.0em; padding-bottom:20px; color:#ffffff;}
.iconcontainer {margin:auto; text-align:center;}
.bottomsection {margin-top:50px;}
.bottomsection .section h1 {text-align:center;}
.bottomsection .section p {text-align:center;}
You can see a live example of whats happening here: https://www.weeboweb.com/idx-websites/
I'm attempting to just use css to make this work. Any help is greatly appreciated. This has had me a bit baffled.
It's not actually scrolling "below", it's scrolling to where it should. The problem is that area is being covered up by your top navigation which stays fixed to the top of the screen. You need to account for this with your spacing, or don't have a fixed top nav.
Its because you forgot to compensate for your header. The page is scrolling so that the element is at the top of the page... Behind the header.
There are several solutions here in a CSS Tricks article that can help you solve the problem.
Here is the solution: Need to correct the navbar implementation before looking at the bookmark issue
First, add padding-top equal to your header height (76px) to your body.
body {
padding-top: 76px;
}
Next, remove the min-height: 76px, make it 0. from your header. Move the position: fixed from your #main-nav to your header element (if possible, else it is fine to be on #main-nav. Add top:0 to the #main-nav
#main-nav {
top: 0;
}
This should solve your problem.
EDIT:
You are using bootstrap, but not using bootstrap navbar-fixed-to-top solution. please refer this - http://getbootstrap.com/components/#navbar-fixed-top
Also note this at the same place in the bootstrap documentation
Body padding required
The fixed navbar will overlay your other content, unless you add padding to the top of the . Try out your own values or use our snippet below. Tip: By default, the navbar is 50px high.
body { padding-top: 70px; }
Make sure to include this after the core Bootstrap CSS.
I was able to fix this by simply adding padding-top:100px; inline to each section element. I did it inline to make sure that the section element doesn't interfere with anything else. I also don't mind the additional space as this particular page warrants it when I finish the design. I don't feel this is the best answer to solving this problem in the future, but in this case it fixed it for me. I also moved the a element outside of the h1 element. You can see ti working here now at https://weeboweb.com.
I'm currently making a website using Zurb Foundation. (See pictures further down)
The way I've layed out my navigation is using the foundation grid as follows:
HTML
<div class="row">
<!-- Navigation -->
<nav class="top-bar">
<div class="five columns">
<div class="one columns"></div>
<div class="five columns menu-elements rightalign">
About
</div>
<div class="one columns">
<div class="split"></div>
</div>
<div class="five columns menu-elements rightalign">
Testimonials
</div>
</div>
<div class="two columns logo">
<img src="images/logo.png" alt="">
</div>
<div class="five columns">
<div class="five columns menu-elements leftalign">
Services
</div>
<div class="one columns">
<div class="split"></div>
</div>
<div class="five columns menu-elements leftalign">
Contact
</div>
<div class="one columns"></div>
</div>
CSS
.top-bar { font-family: 'bebas_neueregular'; display: flex; text-align:center; margin-bottom:0px;
.menu-elements{ color: white; display: block; font-size: 32px; font-weight: normal; height: 45px; ; margin: 60px 0 0 0;}
.menu-elements > a{ color: white; }
.menu-elements > a:hover{ color:#e87524;}
.logo{padding: 10px 0 0 0; text-align:center; margin:auto;}
.split{width: 3px;background: white;height: 28px; font-size: 32px; margin: 60px 0 0 0; text-align:center;}
.leftalign{text-align:left}
.rightalign{text-align:right;}
The problem I'm having is with the way my menu actually looks.
This is with the rightalign and leftalign classes included.
And this is without them included.
I want the menu to be:
1: With the Logo dead center, hence why I've made the navigation into separate div's.
2: The links should take up an even amount of space each, however the way I've coded this makes the Testimonials link take up way more space that the other links, as it is longer which makes it look out of place and closer to the Logo. I tried fixing this by using the text-align style to align both inner links closer to the logo. But it still doesn't look right.
I'm wondering if anyone can think of any other ways I can try? Perhaps making the actual font stretch the letters to meet the edge of the div's or a certain percentage of the div by assigning more space in between the letters? I'll take any advice at this point.
If this isn't necessarily a programming question please point me in the right direction. I am looking for answers as to what I could try in code or in external reading: ie: "Look this up it might help" or "Here try this code it should correct them".
Thanks for any advice!
I'm a total noob at this... I did the whole code academy classes, can't seem to find an answer to my problem anywhere. Basically my site is centralised, from top to bottom it goes;
Logo
Navigation Bar
{Huge random space)
Picture
Copyright note
It's this space I'm trying to get rid of so that the space I have between my logo and the nav bar matches the space between the nav bar and the picture...
Here is my HTML;
<!DOCTYPE html>
<html>
<head>
<title>Access All Areas - Fashion</title>
<link rel="stylesheet" href="stylesheet.css">
</head>
<body>
<div style="min-width: 960px; min-height: 760px; margin: 0 auto;">
<!-- AAA Logo -->
<div class="image">
<center>
<img src="a1.jpg" alt="Access All Areas Logo" width="750px"
height="320px">
</center>
</div>
<!--Navigation Bar-->
<div class="nav">
<center>
<ul>
<li class="main">HOME</li>
<li class="live">LIVE</li>
<li class="studio">STUDIO</li>
<strong><li class="fashion">FASHION</li>
</strong>
<li class="weddings">WEDDINGS</li>
<li class="portraits">PORTRAITS</li>
<li class="about">ABOUT
CONTACT</li>
</ul>
</center>
</div><!--Nav-->
</div><!--Style-->
<!--COVER IMAGE-->
<center>
<div class="cover">
<img src="images/fashion.jpg" alt="Access All Areas Fashion Image"
width="1400px" height="2300px">
</center>
</div><!--Cover-->
<!--Copyright-->
<center>
<div id="copyright">
<p><strong>ALL RIGHTS RESERVED ACCESS ALL AREAS PHOTOGRAPHY</p></strong>
</div><!--Copyright-->
</center>
</body>
</html>
and my CSS;
li {
display:inline;
}
.nav a {
font-family:arial;
font-size:18px;
color: black;
padding:0px 75px 0px 25px;
}
a {
text-decoration:none;
}
.cover {
margin-top:0px;
}
.main {
text-weight:strong;
}
p {
font-family:arial;
font-size:18px;
font-weight:bold;
}
I really hope someone can help me. Another couple of things I'm looking to do is to relocate the copyright text to the bottom left of the image and also make a grid of different sized images and have no idea where to start.
Many thanks
Peter James
Would have been great and easy to solve your problem, if you had provided us with a jsfiddle. But anyway, I think min-height is causing the problem. As you have forcing the header to be 670px tall. See here http://jsfiddle.net/0v4fsg6z/ I have reduced the height to remove the space before Picture Copyright note.
Did you try and set your img tag to position: absolute?
I have a web page which is designed using twitter bootstrap along with it's responsive css inclusion to make everything responsive on different window sizes.But the image in the following codes not re-sizing itself when browser resized, so is not showing responsiveness
<div class="container-fluid">
<div class="row-fluid">
<div class="span"> <div class="media">
<img class="mod-picture" src="images/picture.jpg" alt="post picture" /> <div class="media-container"><a class="link-name" href="#" target="_blank">media name</a></div>
</div></div></div></div>
In css file styles are -
.media-link
{
float:left;
border:1px solid #ccc;
display:inline-block;
color:#3B5998;
cursor:pointer;
margin-right:5px;
}
.mod-picture{
margin-right:10px;
border:0;
display:block;
margin:3px;
}
but if i remove float:left; and display:inline-block; styles from media-link class then image is resizing on browser window size changes.But i can't remove these two properties because next content with class "media-container" need to be appear on right.I tried in many ways like adding float:left in the div before link but failed.Please suggest me.
If you are using bootstrap 3, then you may need to add the class 'img-responsive' to your 'img' tag.
You can take styles from Bootstrap 3 and apply for your code:
<a href="http://facebook.com" target="_blank" class="media-link">
<img class="mod-picture" src="images/picture.jpg" alt="post picture" />
</a>
.media-link{
//nothing styles
}
.mod-picture{
// max width of image
max-width: 50%;
float: left;
display: block;
border:1px solid #ccc;
}
If you are using bootstrap 3 which you should. Then just add class img-responsive to img tag. and That's all to make it responsive.
Here is CDN link for bootstrap3 css. You don't even need to add bootstrap-responsive css.
//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css"
In case bootstrap 2.3 existing problem use this-
<div class="container-fluid">
<div class="row-fluid">
<div class="span-12">
<div class="media">
<a href="http://facebook.com" target="_blank" class="media-link">
<img class="mod-picture" src="images/picture.jpg" alt="post picture" />
</a>
<div class="media-container">
<a class="link-name" href="#" target="_blank">media name</a>
</div>
</div>
<div style="clear:both"></div>
</div>
</div>
</div>
.mod-picture{
width:40%;
padding:5%;
max-width: 200px;
height:auto;
float:left;
}
.media-container{
display:inline-block;
}