Dreamweaver design and live view show different things? - html

please view images below:
http://gyazo.com/c3ffe1d0a48b717f695d7cbd860eda50.png (Design view)
http://gyazo.com/a1e09aacc855c013d349017d0487402d.png (Live & browser view)
As you can see in the design view everything that has been placed on the page looks fine, and is also exactly what I want! But when I go to live view or preview in a web browser it shows differently, with some of the content overlapping my navigation. I really do not know what to do? I will display my code below:
HTML:
<nav>
<ul>
<li> Home</li>
<li> News</li>
<li> Events</li>
<li> Galleries</li>
<li> Video </li>
<li> History</li>
<li> Contact</li>
</ul>
</nav>
<div id="contactheader">
<p>Get in touch with FIFAScene: </p>
</div>
<p> </p>
<div id="contactcontent">
<p>If you have any feedback regarding our website, or wish to comment on anything FIFA eSport related, then please contact us via:</p>
</div>
<p> </p>
<p> </p>
<ul>
<div id="contacthotmail">
<li>FIFAScene#hotmail.com<img src="images/icons/outlook.png" width="112" height="95"></li>
</div>
<div id="contactsm">
<li>www.twitter.com/FIFAScene<img src="images/icons/twitter.png" width="94" height="78">
www.facebook.com/FIFAScene<img src="images/icons/facebook.png" width="67" height="63"></li>
</div>
</ul>
CSS:
nav {
float:left;
position:relative;
}
nav ul li {
display:block;
margin:20%;
padding:30%;
list-style-type: none;
font-family:Segoe UI Light;
font-size:30px;
text-align: center;
}
#contactheader {
text-align:center;
color:#0099FF;
font-family:Segoe UI Light, sans-serif;
font-size:20px;
}
#contactcontent {
text-align:center;
color:#0099FF;
font-family:Segoe UI Light, sans-serif;
font-size:18px;
}
#contacthotmail {
text-align:center;
color:#0099FF;
font-family:Segoe UI Light, sans-serif;
font-size:18px;
}
#contactsm {
text-align:center;
color:#0099FF;
font-family:Segoe UI Light, sans-serif;
font-size:18px;
margin-top:40px;
}
Sorry if I have provided too much information, I am relatively new to designing websites and programming!
Thank you.

Probably your version of DW doesn't see some of the HTML5 elements as a block type element. As a concession to the program you could add a line to the nav element in your css:
display: block;
Thereby embettering the 'prognosis' of the design view as you type.
Edit starts here:
Myself I use the Design-View to type content. It can be handy for some UTF characters, like the double quotes for instance. I use it a lot when writing (un-)ordered lists. Sometimes I use it to type content without the visual aids or css enabled. My advise is to use it as a tool but to have a browser open at the same time, with your document loaded. Adobe provided several tutorials that offered strategies for almost have a consistent preview of the page in design-view, but that's almost. Live view offers a better standard.
Because of a comment, I tried the code in DW5.5. I wanted to see how far I would get keeping the nav and main tag and have these as floats.
To have some consistency in preview of the design-view and Live-View (hitting ALT+11 on windows) a wrapper that would clear the float (see the link to an article of Louis Lazaris) seemed to help.
I tried the the pyramid layout of the contact logo's as floats, but I could not center the two links below properly without too much hustle. To have these centered as well I made these display as inline-blocks.
Further the padding on the navigation list-items were a bit exotic having 50% on both sides.
html,
body {
width: 100%;
}
body {
font: 18px/1.25 "Segoe UI Light";
color: #0099FF;
}
html, body,
h1, h2, h3, p, ul, li,
div,
nav, main,
a, img,
a img {
margin: 0;
border: none;
padding: 0;
}
h1 {
font-size: 2.618em;
text-align: center;
padding: 1em 0;
margin-left: 20%;
margin-right: 5%;
}
a {
color: #0099FF;
text-decoration: none;
}
.wrap {
width: 100%;
overflow: hidden;
}
nav, main {
float: left;
text-align: center;
}
nav {
overflow: hidden;
position: relative;
width: 20%;
}
main {
width: 75%;
text-align: center;
}
ul {
list-style-type: none;
}
nav ul {
}
nav ul li {
font-size: 1.666em;
}
nav ul li a {
display: block;
line-height: 2.25;
}
.contactheader {
font-size: 1.666em;
}
.contactcontent {
font-size: 1em;
}
.contactsms {
display: inline-block;
margin: auto;
}
.contactsms ul {
}
.contactsms ul li {
display: inline-block;
padding: 1em 1em;
margin: 0 auto;
}
.contactsms ul li img {
white-space: nowrap;
vertical-align: text-bottom;
}
.whiteSpace {
height: 2em;
}
<div class="wrap">
<h1>Contact Us</h1>
<nav>
<ul>
<li>Home</li><!--
--><li>Design</li><!--
--><li>View</li><!--
--><li>Mess</li><!--
--><li>Video </li><!--
--><li>History</li><!--
--><li>Contact</li>
</ul>
</nav>
<main>
<div class="contactheader"><p>Get in touch with DreamWeaver:</p></div><!-- contactheader -->
<div class="whiteSpace"></div><!-- whiteSpace -->
<div class="contactcontent">
<p>If you're interested in how the design view could be of help in your <em>'workflow'</em>, its abilities and disabilities, look out for AdobeTV tutorials like:</p>
</div><!-- contactcontent -->
<div class="whiteSpace"></div><!-- whiteSpace -->
<div class="whiteSpace"></div><!-- whiteSpace -->
<ul>
<li class="contacthotmail">Taming the Web, Greg Rewis<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/7b/Adobe_Systems_logo_and_wordmark.svg/200px-Adobe_Systems_logo_and_wordmark.svg.png" width="112" height="95"></li><!--
--><li class="whiteSpace"></li><!--
--><li class="whiteSpace"></li><!--
--><li class="contactsms">
<ul>
<li>StackOverflow: center floats?<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Stack_Overflow_logo.svg/200px-Stack_Overflow_logo.svg.png" width="94" height="78"></li><!--
--><li>clearing-floats/louis-lazaris<img src="https://upload.wikimedia.org/wikipedia/en/c/c0/Smashing_Magazine_logo.png" width="67" height="63"></li>
</ul>
</li>
</ul>
</main>
</div>

If you want to use Dreamweaver you should ditch the design view and get in the habit of previewing everything in the browser and troubleshooting with the browsers web inspector.
If you really want to see a live preview of your css and positioning, you can do some of that in the web inspector. If you have access to a Mac you should consider looking at Espresso <Link> by the folks at macrabbit.
Also, beware of the non breaking space returns (<p> </p>) tags that Dreamweaver is making, delete em and use css instead.

Related

Add CSS Styles to Just One HTML element

I have just started learning about web development and I'm having some issues. In the website that I am currently creating I have a navigation menu. However, I also have other ul and li elements throughout the main content of the web page. I have been trying to get certain styles to apply to just my navigation bar and not the bulleted lists in my content but no matter what I try, I either get the styles on both my navigation and the content or on none. I have looked on google and a lot of different websites, I have tried having the .navigation and # in front of my styles but nothing seems to be working. I must be doing something wrong somewhere but I have no idea what it could be. If someone could help that'll be wonderful! The following is my navigation barcode:
<div id=navbar">
<ul>
<li>
Home
</li>
<li>
About Volleyball
</li>
<li>
Sign-Up
</li>
<li>
Announcements
</li>
<li>
Contact Us
</li>
<li>
Links
</li>
</ul>
</div>
and these are the styles on my separate css style sheet that I wish to apply to just the above code:
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #4da6ff;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 75px;
text-decoration: none;
}
li a:hover {
background-color: #80bfff;
}
You can simply select only elements which are children of you navbar by prepending your selectors with #navbar which selects the element with the id navbar and the selectors after that will only search in its children:
#navbar ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #4da6ff;
}
#navbar li {
float: left;
}
#navbar li a {
display: block;
color: white;
text-align: center;
padding: 14px 75px;
text-decoration: none;
}
#navbar li a:hover {
background-color: #80bfff;
}
<div id="navbar">
<ul>
<li>Home</li>
<li>About Volleyball</li>
<li>Sign-Up</li>
<li>Announcements</li>
<li>Contact Us</li>
<li>Links</li>
</ul>
</div>
<ul>
<li>No styles applied</li>
<li>No styles applied</li>
</ul>
In your .css file you can create classes to use across elements.
Try this in the .css file.
.hello {
color: blue;
text-align: center;
}
Then try this in your html
<h1 class="hello">Hello World</h1>
This will apply the style defined in the .css file to the element with the class "hello".
More information about classes can be found here: https://www.w3schools.com/cssref/sel_class.asp
If you want to add style to any specific element then you can add CSS code to that specific element like: for tag you can use p{color:red} OR by using class: p.my-element{color:red} or using ID: p#{color red}
You are in your initial phase of learning development. So read and write your own code.
Look into id's and classes.
This will allow you to style elements seperately.

How do I get my List Items to move up a Little in CSS

I am new to this and need a little help.
Just designing a random website for some practice and I can't seem to get my topmenu on my header to move up. I've changed padding's & margins in a few places and can't seem to get it to work. Wonder if I'm missing something or if there is a better way to organize my CSS. Any help would be greatly appreciated. Thanks :)
#main {
margin-left: auto;
margin-right: auto;
width: 800px;
}
body {
margin:0;
}
#topbar {
background-color: black;
height: 80px;
width: 100%;
margin-top: 0;
margin-bottom:0;
font-family:Verdana, Arial, Helvetica, sans-serif;
}
#text {
display:block;
color: White;
float:right;
padding-right: 820px;
padding-top: 10px;
font-size:20px;
}
#topmenu {
display:block;
list-style:none;
padding:0 400px 0px 0px;
float: right;
}
#topmenu li {
display: inline;
}
#topmenu a {
position:relative;
padding:0 4px 0 4px;
font-size: 13px;
text-decoration:none;
}
#topmenu a, #topmenu a:visited, #topmenu a:active {
color:white;
}
I want the menu to move up ever so slightly.
<div id="topbar" >
<div id="text"><strong>My Template Website</strong></div>
<div id="topmenu">
<ul>
<li><a href=""/>Home</li>
<li><a href=""/>About Us</li>
<li><a href=""/>Services</li>
<li><a href=""/>Product</li>
<li><a href=""/>Contact Us</li>
</ul>
I assume you already reduced the margin-bottom of the headline and the margin-top of your topmenu to 0 and now you need a way of bringing the topmenu up a bit more without absolute positioning. What you might not know is, that it is allowed to use a negative margin on the menu to bring it up:
#topmenu {
/* ... your other styles */
margin-top: -15px;
}
Before applying this you shoud check the margin of your ul which probably has a margin by the browsers default stylesheet:
You can check this by yourself when debugging the page in the web console (all popular browsers have one; e.g. in Firefox you have to press F12).
I don't know what the rest of your site looks like and if the surrounding div#topmenu is really required. But if not, you could remove it and give the id to the ul, then remove the margin-top from your new #topmenu. The advantage of this is that you don't have to manage two different elements, which possibly was the reason for your confusion in this example.
<div id="topbar" >
<div id="text"><strong>My Template Website</strong></div> <!-- <h1> instead for semantic reasons? -->
<ul id="topmenu">
<li><a href=""/>Home</li>
<li><a href=""/>About Us</li>
<li><a href=""/>Services</li>
<li><a href=""/>Product</li>
<li><a href=""/>Contact Us</li>
</ul>
</div>

CSS drop down menu sub-items overlapping

Good day, this is my first ever question on Stack Overflow, so I hope I get it as right as possible.
I have done extensive research on my problem, mostly reading all the questions I could find on Stack Overflow and some other sites, but I could not find one answer that worked.
Some background: I am trying to write a website for recruiting for my work and it's the first ever website I have ever written. I am using a wamp server to run the site on localhost for testing. My issue is described as best as I could in the title. Find below my html code:
<html>
<head>
<title> BCB Call Plus SRL Home </title>
<link rel="stylesheet" href="Main Style.css">
</head>
<body>
<div id = "main_content">
<ul id = "nav_container">
<li> <img id = "logo" src= Logo.png style ="width:150px;height:75px"> </li>
<li> Home </li>
<li> Menu 1 </li>
<li> Menu 2 </li>
<li> Menu 3 </li>
<li id ="angajari"> <a class="dropdown_toggle" data-toggle="dropdown" href= "Page4.html"> Angajari </a>
<ul class="sub_menu">
<li>Ce Vrem</li>
<li>Aplica</li>
</ul>
</li>
</ul>
</div>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
And below my CSS code:
body {
text-align:center;
}
a {
font-size: 150%;
text-decoration: none;
color:#000000;
font-weight: bold;
vertical-align:middle;
}
a:hover{
background-color:#338533;
}
ul {
padding:0;
margin:0;
}
ul#nav_container{
background-color:#F2FFF2;
list-style-type:none;
text-align:center;
}
ul#nav_container li{
display:inline-block;
padding-left:5px;
padding-right:5px;
vertical-align:middle;
position:relative;
}
.sub_menu li a{
display:none;
}
#angajari ul.sub_menu li {
float:left;
}
#angajari ul.sub_menu li a {
position:absolute;
top:0;
white-space: nowrap;
height:auto;
}
#angajari:hover ul.sub_menu li a {
display:block;
}
Here's a picture of what happens when I hover over the problematic menu item:
Display Issue
Final notes: I am running this only under Chrome for now. I have noticed that it doesn't read my css right in IE 8 (yes, I use IE 8, because one of my bosses wants us to.) Cross-platform compatibility fixes are welcome, but not in the scope of my current question. My WAMPSERVER has apache 2.4.9 and PHP 5.5.12.
I even tried my code on some online web code testing site whose name I forgot and got the same results. If you find that my code actually displays properly, then it may be an issue with my configuration.
Here is a jsfiddle.
You need your .sub_menu to be absolute, not your li as. That's it!
.sub_menu {
position:absolute;
}
Working demo here: http://jsfiddle.net/pxzhqqnb/1/
And I'd make the .sub_menu hidden instead of its children. Personal preference, but I think it makes more sence.
Why does it happen?
Consider this simple example: (think of .relative as position: relative and .absolute as position: absolute)
<div class="relative">
Text
<div class="absolute">Link 1</div>
<div class="absolute">Link 2</div>
</div>
Link 1 is absolute. It searches for the closest relative element. That's .relative. Now Link 1 gets right under the relative div.
Link 2 follows the same rules, thus both links overlap.
Now let's change the code a little:
<div class="relative">
Text
<div class="absolute-wrapper">
<div>Link 1</div><!-- these are now static by default -->
<div>Link 2</div>
</div>
</div>
absolute-wrapper is absolute, so it searches for the closest .relative element and gets right under it. Now both links are normal elements wrapped in a div, so they render as expected.
Demo of both examples here: http://jsfiddle.net/w0h7cdhe/2/
I've done a few tweaks to your css code:
body {
text-align: center;
}
a {
font-size: 150%;
text-decoration: none;
color: #000000;
font-weight: bold;
vertical-align: middle;
padding: 0px 10px; /* this is just for the hover effect to lose the spaces in the html */
}
a:hover {
background-color: #338533;
}
ul {
padding: 0;
margin: 0;
}
ul#nav_container {
background-color: #F2FFF2;
list-style-type: none;
text-align: center;
}
ul#nav_container li {
display: inline-block;
padding-left: 5px;
padding-right: 5px;
position: relative;
}
#angajari ul.sub_menu { /* do this with the menu, not just the link */
display: none;
position: absolute; /* set correct position */
}
#angajari ul.sub_menu li {
display: inline-block;
}
#angajari ul.sub_menu li a { /* we don't want top: 0 because it should not overlap */
white-space: nowrap;
}
#angajari:hover ul.sub_menu { /* see above -> menu not link */
display: block;
}
<div id="main_content">
<ul id="nav_container">
<li>
<img id="logo" src="http://lorempixel.com/150/75" style="width:150px;height:75px">
</li>
<li> Home <!-- I've removed the spaced and added the gap in css -->
</li>
<li> Menu 1
</li>
<li> Menu 2
</li>
<li> Menu 3
</li>
<li id="angajari"> <a class="dropdown_toggle" data-toggle="dropdown" href="Page4.html">Angajari</a>
<ul class="sub_menu">
<li>Ce Vrem
</li>
<li>Aplica
</li>
</ul>
</li>
</ul>
</div>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
So i tried to fix your Problem i end up with this result
I've adjusted the margin of the logo as shown below:
<li> <img id = "logo" src= Logo.png style ="width:150px;height:75px;margin-left: -50px;"> </li>
because I adjust the width of the text container and replace the last 4 lines in your CSS CODE as shown below:
body {
text-align:center;
}
a {
font-size: 150%;
text-decoration: none;
color:#000000;
font-weight: bold;
vertical-align:middle;
}
a:hover{
background-color:#338533;
}
ul {
padding:0;
margin:0;
}
ul#nav_container{
background-color:#F2FFF2;
list-style-type:none;
text-align:center;
}
ul#nav_container li{
display:inline-block;
padding-left:5px;
padding-right:5px;
vertical-align:middle;
position:relative;
width: 95px;
}
#main_content ul ul {
position: absolute;
visibility: hidden;
}
#main_content ul li:hover ul {
visibility: visible;
}
so i made minor changes but i dont know if that's what you want to happenenter code here

HTMl/CSS webpage formatting mishap on re-sizing.

I am trying to make a template for my webpage. I am creating a header and a footer, and have the content in between. But for some reason, I cant get any of it to work. I have been fooling with this for hours and cant find answers.
I have a logo, I am trying to position it inside the that way it looks clean. But I cant. I wont stay centered on my navigation text! I then notice when I resize my browser, it shifts all my navigation links until they all fit on the screen. How do I fix that?
Upon looking around for the fix, I noticed that I should instead convert all my position: absolute; top: (so many px) left: (so many px); to percent style measurements..no such luck. Once I get this working, I should be pretty much over the hardest part.
here is the css file:
//this is not in the div tag rather a test logo outside.
#logo{
display: inline;
float: left;
}
.nav{
display: inline;
float: left;
width: 5;
border: 1px solid #C0C0C0;
margin: auto;
text-align: center;
}
.nav ul{
list-style-type: none;
}
.nav li{
display: inline;
}
.nav li img{
height: 30px;
}
.nav a{
text-decoration: none;
padding: 20px 5px 20px 20px;
font-weight: 900;
color: #C0C0C0;
font-family: monospace;
font-size: 20px;
display: inline;
}
.nav a:visited{
color: #C0C0C0;
}
.nav a:hover{
color: black;
}
here is the html
</head>
<meta charset="UTF-8">
<meta name="description" content="This is a website that offers free information on IT">
<body>
<!--
Creating the navigation bar. I used nav as the dic class name with an unordered list
-->
<img src="Images/logo.png">
<div class="nav">
<ul>
<li><img src="Images/logo.png"></li>
<li> Home</li>
<li>Contact</li>
<li>Service</li>
<li>About</li>
</ul>
</div>
<div class="ad">
<center>
<img src="Images/head_pic.jpg">
<center>
</div>``
adding
min-width: (whatever);
fixed most of my issues.

Nav bar buttons

I'm trying to create nav bar similar to that of Uber's site. Where there's a menu button on the left, logo in the center, and then log in and sign up are on the right.
I used and div container="pull-right" and still couldn't get the Title to be center. The buttons won't be stylized much more than what they are since they will be on a white background.
<div class="nav">
<div class="container">
<ul>
MENU</button></li>
TITLE</button></li>
SIGN UP</button></li>
LOG IN</button></li>
</ul>
</div>
</div>
.nav{
color: #5a5a5a;
font-size: 15px;
font-weight: normal;
padding: 15px 15px 5px 5px;
word-spacing: 3px;
}
.nav li {
display: inline;
}
.nav button {
background-color: Transparent;
background-repeat:no-repeat;
border: none;
cursor:pointer;
overflow: hidden;
outline: none;
}
.nav a{
color: inherit;
}
Here's my Jsfiddle: https://jsfiddle.net/tokyothekid/r19y23ep/1/
you can try this fiddle
demo
in this i have manage the structure of your li and as per your description i make a design i hope it may help you
.col1
{
margin:0;
padding:0;
float:left;
width:50%;
}
Quick answer
If you want something like the website for Uber, you probably need to separate the Menu from the buttons on the right side.
Other notes
Also, HTML5 has specified special tags so code is more readable and organized, such as the <nav> tag to hold your main menu. <div> doesn't communicate the purpose of the container.
To do what you want, here is a to-do list:
fix your bugs (<a href="somewhere"<li><button>foobar</button></li></a> actually is an error because of the lack of right bracket > at the end of your opening <a> tag)
separate your elements into a menu, a title, and a couple of user account buttons
The code
Here is a good example of how you could restructure your HTML:
<h2 class="top-title">Title</h2>
<nav>
<button id="toggle-menu">Menu</button>
<ul>
<li>Menu 1</li>
<li>Menu 2</li>
</ul>
</nav>
<div class="user-buttons">
<button>Log in</button>
<button>Sign up</button>
</div>
This is a quickly hacked bit of CSS you might use to start with:
h2 {
display: inline-block;
width: 100vw;
text-align: center;
margin: 0;
position: absolute;
z-index: -1;
}
nav {
float: left;
}
nav ul {
list-style-type: none;
padding: none;
position: absolute;
}
nav ul a {
text-decoration: none;
text-transform: uppercase;
color: inherit;
}
div.user-buttons {
float: right;
}
Add some Javascript, and voila:
$(function() {
$("nav ul").hide();
$("#toggle-menu").click(function() {
$("nav ul").toggle();
});
});
JSFiddle example.