How to make text like logo in this case? - html

See my website here http://1-dot-speaklikewater.appspot.com
and the code
<img style="vertical-align: middle;" src="speaklikewaterlogo.png" />
<a href='index.jsp' class='linkButton' >Home</a>
.linkButton:link, .linkButton:visited {
background-color: white;
color: black;
border: 2px solid green;
padding: 7.5px 15px;
text-align: center;
text-decoration: none;
display: inline-block;
}
.linkButton:hover, .linkButton:active {
background-color: green;
color: white;
}
This's ok, but the image quality is not good because when users magnify the page the image got blurred.
No, I don't want to use image as logo. I want to use Text like a logo.
Can you do the Exactly same thing like the above website but this time we use Text instead of image for logo. So it should look like this, but the middle of "Home" and the middle of the text logo should be on the same line?
SpeakLike
Water.com Home ...
Can we achieve that?

Can we achieve that?
Sure here is an example how to do this;
ul {
list-style: none;
padding: 0;
margin: 0;
}
li {
display: inline-block;
line-height: 44px;
vertical-align: middle;
}
li a {
background-color: white;
color: black;
border: 2px solid green;
padding: 7.5px 15px;
text-align: center;
text-decoration: none;
display: block;
line-height: 1;
font-weight: bold;
}
.logo-box {
margin-right: 10px;
}
.logo-line {
display: block;
line-height: 22px;
color: #D42424;
font-weight: bold;
}
<ul>
<li>
<div class="logo-box">
<span class="logo-line">SpeakLike</span>
<span class="logo-line">Water.com</span>
</div>
</li>
<li>Home</li>
<li>Online Users</li>
<li>Method</li>
<li>Lesson</li>
<li>Conversation</li>
<li>Register</li>
<li>Login</li>
</ul>

I'm going to assume you know how to display text and style it, if you need me to explain, just say so.
This leaves the problem of centering the logo with "Home". You have two options to do this
1) Margin
.logo {
margin-top: -20px;
}
This will shift the .logo up 20px. Adjust margin as needed to properly center.
2) Position
.logo {
position: relative;
top: -20px
}
This does the same thing, but uses positioning instead of margins. This option is better in terms of having less hacky CSS.

Yes, you can use an <h1> element and style the text accordingly (you can even use web fonts, if you wish). Something like:
h1 {
color: #cc0000;
font-family: "Times New Roman", serif;
width: 100px;
word-wrap: break-word;
font-size: 20px;
float: left;
}
ul {
list-style-type: none;
position: relative;
top: 30px;
}
ul li {
float: left;
margin: 0 10px;
}
<h1>SpeakLikeWater.com</h1>
<nav>
<ul>
<li>Home</li>
<li>Lorem</li>
<li>Ipsum</li>
<li>Dolor</li>
</ul>
</nav>

Related

How can I apply CSS to this div class?

I am trying to make an image be 300px width in CSS. I created a div class around the image "mainpic" in HTML, and then in CSS, I did .mainpic and width:300px; but it's not changing sizes. Any ideas why the CSS is not applying to this div class? Thank you and code below!
Here's the HTML (minus head section):
<body>
<ul>
<li>Home</li>
<li>Information</li>
<li>Sources</li>
</ul>
<h1>Katherine Graham </h1>
<h2> Silver Spoon to CEO</p>
Democracy Dies In the Dark
<br>
<div class="mainpic">
<img src="http://t2.gstatic.com/licensed-image?q=tbn:ANd9GcR42mPHUzh3APxp1Q8iK6BiQNns98VuwX9zk2nQvukALjFAc8207NEMfcOES8Qe" alt="Katherine Graham">
<div>
<caption>Katherine Graham</caption>
</body>
Here's the CSS:
h1{
color:red;
font-size: 50px;
text-decoration: underline;
}
h2 {
font-size: 25px;
}
ul li {
display: inline;
background-color:;
margin: 10px;
border-radius: 25%;
border-color:khaki;
padding: 25px;
border: 25px;
width: 90px;
list-style-type: none;
}
body {
background-color: antiquewhite;
}
.mainpic {
width: 300px;
}
You need to specify width for img also, otherwise it would keep its original width.
h1 {
color: red;
font-size: 50px;
text-decoration: underline;
}
h2 {
font-size: 25px;
}
ul li {
display: inline;
background-color: ;
margin: 10px;
border-radius: 25%;
border-color: khaki;
padding: 25px;
border: 25px;
width: 90px;
list-style-type: none;
}
.mainpic {
width: 300px;
}
<ul>
<li>Home</li>
<li>Information</li>
<li>Sources</li>
</ul>
<h1>Katherine Graham </h1>
<h2> Silver Spoon to CEO</p>
Democracy Dies In the Dark
<br>
<div class="mainpic">
<img src="http://t2.gstatic.com/licensed-image?q=tbn:ANd9GcR42mPHUzh3APxp1Q8iK6BiQNns98VuwX9zk2nQvukALjFAc8207NEMfcOES8Qe" alt="Katherine Graham" width="100%">
<div>
<caption>Katherine Graham</caption>
Your container width .mainpic is already taking 300px;
Try to add .mainpic img {width:100%}.
This will work for sure.

The Footer and header will not allow me to position any of contend on the site

when I try to add in h3 onto the website it just stay at the top I tried to use position, top,left in the CSS but it doesn't want to response to it. I also tried to use a gallery template from w3schools to see if it will let me move the gallery but still no luck. I have tried to research this but I had no luck at all. sorry for the long code.
<html>
<link rel="stylesheet" href="sheet.css">
<head>
<title> Jon Barton </title>
</head>
<header>
<ul class= "nav-men">
<li> Gallery </li>
<li>About me </li>
<li> Contract me</li>
</ul>
<h1><span> Software Developer </span> </h1>
<p class = "kicker" >Ideas // Desinger // Implement </p>
</header>
<body>
<h3> Work</h3>
<footer>
<div class = "footer">
<div class ="content-wrap">
<ul>
<li> </li>
<li> </li>
<li> </li>
</ul>
<p class = "copyright"> All content copyright 2016</p>
</div>
</div>
</html>
The css is a bit long sorry and some of it is just repeated.
#css
header {
background: url(.//277H.jpg) ;
text-align: center;
width: 100%;
height: auto;
position: absolute;
}
.nav-men li {
display:inline;
margin-left: 100px ;
}
.nav-men ul{
margin: 30px 30px 0px 0px;
padding: 0;
list-style-type: none;
text-align: center;
text-decoration: none;
}
.nav-men a {
color:white;
}
.nav-men a:hover, a:visited, a:link, a:active
{
text-decoration: none;
}
h1 {
font-size: 60px;
color: white;
letter-spacing: 0.05em;
text-transform: uppercase;
text-align: center;
font-weight: 700;
margin-bottom: 20px;
}
span {
display: inline-block;
padding: 0.2em 0.6em ;
border: white solid 10px;
}
.kicker {
text-align: center;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5em;
color: white;
}
body {
margin: 0;
padding: 0;
height: 100%;
}
.alt-selction {
background: black;
}
.thumb-container {
max-width: 980px ;
margin: 0px auto ;
padding-bottom: 100px;
}
.thumb-unit {
display:block;
width: 25%;
height: 150px;
float:left ;
}
.footer {
margin: 30px;
background: url(../277H.jpg) ;
width: 100%;
height: 100px;
clear: both;
bottom: -53px;
left:-30;
right:0;
position: absolute;
background-size: cover;
float: left;
}
.content-wrap {
float: left;
}
li {
display:inline;
margin-left: 100px ;
}
ul{
margin: 30px 30px 0px 0px;
padding: 0;
list-style-type: none;
text-align: center;
text-decoration: none;
}
a {
color:white;
}
a:hover, a:visited, a:link, a:active {
text-decoration: none;
}
That's because the position of the <header> and footer is absolute.
position:absolute positioned an element relative to the nearest positioned ancestor instead of positioned relative to the viewport, like fixed.(from here)
Remove the position:absolute from the class header & .footer. Then it will let you put anything between them.
Use this tutorial to have a sticky footer:
[https://css-tricks.com/snippets/css/sticky-footer/]
After just add div at the top as a Header and you can add as many content between them after.
I would recommend first cleaning up a bit of your HTML to put your header and footer inside the body element, and closing your body element properly as otherwise you will most probably run into other problems.
See this fiddle for an example:
https://jsfiddle.net/jowxoaca/1/
Also, as jonju mentioned, removing the position:absolute for header and footer would fix your ordering issue.

How can I get these buttons centered vertically on my navbar

I'm struggling to get these buttons on the right and the heading on the left centered vertically on my navbar. I'm not using Bootstrap. I've tried a number of combinations of padding and margins and can't seem to make it work. Can anyone help please?
HTML:
<header>
<nav>
<h1>Jason</h1>
<div class="navbar-box">
<ul id="navbar-links">
<button>
<li>About</li>
</button>
<button>
<li>Portfolio</li>
</button>
<button>
<li>Contact</li>
</button>
</ul>
</div>
</nav>
</header>
CSS:
nav {
background-color: #061839;
color: white;
height: auto;
}
.navbar-box {
background-color: #061839;
color: white;
height: 25px;
}
h1 {
margin-top: 5px;
padding-top: 40px;
padding-left: 30px;
font-size: 40px;
}
ul {
list-style-type: none;
}
li a {
display: inline;
float:right;
}
button {
background-color: #4D638C;
border: none;
color: white;
margin-right: 20px;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
float:right;
border-radius:12px;
}
try adding display:inline-block and vertical-align:middle both to heading (h1) and buttons container which is .navbar-box
Use margin auto
that should centralise them

href tag not working. css style interfering?

I'm relatively new to HTML (only a few weeks now), and I'm stuck. The "about" section on my page doesn't seem to be clickable and won't bring me to the linked page. The confusing thing is that the link appears to be clickable since the floating hand icon appears when hovering over the link. I can right-click and open the link in a new tab. If I delete the css and try the link without the formatting, it is also valid.
I'm confused... is the CSS somehow messing with my href tag?
here's the html:
<div id="header">
<div class="container">
<div class="row">
<div class="twelwecol last">
<div id="navigation"> <!-- Navigation Links -->
<ul>
<li>about</li>
<li>members</li>
<li>events</li>
<li>media</li>
<li>social</li>
</ul>
</div>
</div>
</div>
</div>
</div>
and the code from the "navigation.css" page:
#header {
width: 100%;
height: 49px;
color: white;
background-color: #1b1e25;
position: fixed;
z-index: 9999;
}
#logo {
background-image: url('../images/assets/logo.png');
background-repeat: no-repeat;
height: 80px;
width: 80px;
display: block;
float: left;
}
#navigation {
padding-top: 2px;
width: 480px;
display: block;
margin: 0px auto;
}
#navigation ul {
padding:0px;
margin: auto;
text-transform: uppercase;
}
#navigation ul li {
display:inline;
float:left;
list-style:none;
padding: 13px 20px 13px 20px;
}
#navigation ul li {
display:inline;
float:left;
list-style:none;
padding: 13px 20px 13px 20px;
}
#navigation ul li a {
color: gray;
text-decoration: none;
font-family:'Scada', sans-serif;
font-size: 13px;
}
#navigation ul li a:hover {
color: white;
}
.current {
border-bottom: 1px solid #cb1c1c;
color: white;
}
#contact {
padding-top: 12px;
float: right;
position: relative;
}
#contact a {
text-decoration: none;
text-transform: uppercase;
font-size: 9px;
color: gray;
padding: 11px;
}
#contact a:hover {
color: white;
border: #333333 1px solid;
padding: 10px;
}
Could someone please tell me what is going on here? Any help would be most appreciated!
it appears clickable because it is contained within the a tag. When you link something your href needs to have a proper extension. Are you sure youre using .htm and not html?
furthermore CSS affects Style (css= cascading style sheet) it wont affect html (or any other) functions like the href function.
try changing your href to href="about.html"

How to get rid of whitespace in my menu

So I'm making a site for a school project and I want to know how I can remove the whitespace on the sides of the menu when hovering over the first and last links. Here's the fiddle.
Sorry if my code is not that great, I'm a beginner...
Also I notice that my menu is staying still but everything else is going crazy with positioning when in different resolutions. How do I get it so everything stays in relatively the same position in different resolutions?
Thanks.
Oh and here's the html:
<body>
<h1 class='titles'>Phosphorus 4 Dummies</h1>
<nav>
<ul class='menu'>
<li id='home'><a href='#'>Home</li></a>
<li id='phys'><a href='#'>Phys. Prop.</li></a>
<li id='chem'><a href='#'>Chem. Prop.</li></a>
<li id='facts'><a href='#'>Fun Facts</li></a>
</ul>
</nav>
<p class='info'>Phosphorus is a very reactive element in the Nitrogen Group. It has 15 protons, 16 neutrons, and 5 valence electrons. It is a non-metal so it can be found on the right side of the zig-zag along with other non-metals. Its symbol is a simple P.</p>
<img src='http://images-of-elements.com/red-phosphorus.jpg' id='redPhosphorus' height=300px />
And the css:
body {
margin: 300px;
padding: 0px;
}
.titles {
font-size: 72px;
font-family: Helvetica, sans-serif;
text-align: center;
position: relative;
bottom: 100px;
}
.menu {
position: relative;
width: 760px;
bottom: 330px;
margin: auto;
margin-bottom: 0px;
text-align: center;
border: 2px solid black;
border-radius: 5px;
padding: 0;
font-size: 0;
}
.menu li {
font-size: 36px;
font-family: Helvetica, sans-serif;
display: inline-block;
position: relative;
top: 0;
float: none;
}
.menu li a {
text-decoration: none;
color: black;
padding-right: 11px;
padding-left: 11px;
padding-top: 0px;
padding-bottom: 1px;
border-right: 2px solid black;
margin: 0;
}
.menu li:nth-child(4) a {
border: none;
}
.menu li a:hover {
background-color: orange;
}
There is whitespace because your menu is set at a width: 760px, but your menu list does not fit all the way across, so there is white space.
Also, to make it responsive, you need to use media queries.
UPDATE:
If you know the expected results [height, width, etc] you have to give your <nav> the set width, and the <ul> to a larger width, but add overflow: hidden and height: 41px
Here is a fiddle to experiment with. You did not have an ideal layout, but I've worked with what you gave. If anyone finds a better solution I would be more than happy to observe.
i took a look at your code, you nested the elements wrongly, make sure to close the a tag first
<li><a></li></a>
should be:
<li><a></a></li>