Create navigation Bar From Different HTML, Link to Main HTML - html

i just wanted to find out is it posible to make a navigation bar or image slide from a different html & css and link it to the main index.html?
if it is possible how to do it, or must it be done as a script?

It's possible to do this with both Javascript/jQuery and PHP. It's also possible to do this with an iframe, but iframes are honestly used to load a new web page within your site and they are hardly ever used, plus HTML5 is going to depreciate them once it becomes standard. So to answer your question, yes, it's something that needs to be done with a scripting language

Related

Bookmark in HTML/CSS

Is there a way to Bookmark using HTML/CSS? I have been developing this mobile application in HTML and want to be able to give the option to bookmark certain pages to the users. Is there a way to do this in HTML?
There isn't a way in pure HTML (since it's just a markup language) or CSS (this just define the style), since bookmarking is an action done exclusively by the browser without iteration with the web page. I'm aware that JavaScript can do it.
I don't think so, as HTML is only a markup language, not supposed to interfere in browser's data or configuration. In case JavaScript is also an option for you, please refer to this answer.

simple static html menu

I'm new at HTML and need to do a simple site as an assignment. For the site navigation menu I guess it would be easy to simply copy and paste the navigation menu HTML onto all the pages in a header div. But is there a better way to do this?
for example, is there an easy way (that doesn't require scripting) to only write the code in one place and have it included on every page? I remember that I did something in Dreamweaver that created a template page that included the navigation menu. However I have a feeling that that was just copying html between pages.
Without scripting your HTML files will need to contain the menubar in full.
You are describing what a server side scripting language can do. Without one - your HTML files are served as they are. Therefore they must contain the HTML for the menubar within them.
The comments mention using an iframe - though very creative - I believe it doesn't satisfy as being "a better way to do this"
You have must use HTML code every page without HTML does't work Try to learn some basic PHP it will help

Simple blog in CSS and HTML only

I have a simple html/css-only static website on which I would like to add a blog. Comments and RSS aren't necessary.
Now, how do I do that, without having to write all my entries in pure html?
My website consists of a vertical menu and an area to the right of it, where all the content goes on each page. I would like a blog inside that area on the blog page, so a blog on a separate page with its own layout is not what I'm looking for.
Googling this doesn't really help me much since the majority of the hits are on sites offering blog services.
Thanks in advance, I hope I'm not being too difficult. Please leave some feedback on my question if you think there are things I should have tried out before asking.
If i understand what you want the answer is that ist is not possible in pure html and css. With only Html and css you can not make a blog (if you dont want to edit the source everytime you write an entry and have to make a new file for each entry and so on).
You need some code (php or so) that is able to store and load the entrys into your site.
Html and css are not meant to make things working. With Html you define the elements so that they are structed and then with css you "style" your work. But for the task of a blog (i think you want an editor for the text on the site, the ability to edit, delete, more than one site and so on) you need something like php or aps.net that is able to "interact".

Is it possible to create a web site header without copying and pasting it on every page?

I'm building a small-scale website (a personal one) in which each page would have the same set of header elements (I'm not talking about the <head> element). In other words, I want each page to have essentially the same title at the top of the page and the same navigation bar below that (with possibly minor differences in each page). It's kind of like how StackOverflow has that navigation bar (with the logo, and the Questions, Tags, etc. buttons) on the top of every page.
Is it possible create such a header for every web page without copying and pasting the HTML code to do so? I really don't want to run into a situation where if I want to make a single change, I would have to change all of my pages containing the header.
Real web sites use real web frameworks, which have a concept called a "layout" (at least that's what they're called in Rails; as mentioned in Uwe's answer, they're called master pages in ASP.NET). All the common "templatey" stuff goes into a layout.
How about include files in a server-side language like PHP or master pages in ASP.NET?
You need to use some kind of dynamic page processing, whether it's PHP, a server-side include, or a similar tool.
If you need to stick with straight HTML, you could try to rig something up with AJAX or JavaScript - but then you highly limiting your website's functionality, giving it serious performance issues, AND preventing users who have JavaScript disabled from using your website.
A third answer is to use some sort of pre-deployment tool. This used to be a bigger market, but I think it's mostly dried up now. Here's an example for using DreamWeaver to handle this.
If you have a PHP server that supports PHP,
<?php include 'header_inc.php'; ?>
If that's not available
<!--#include virtual="header_inc.html" -->
But whether this works or not is server dependent
If you have a server with PHP capabilities
include 'header.inc.php';
you must put the header code in a file named that and then put that include code in all pages that you want the header to show up on

CSS and HTML - Can CSS files generate HTML?

I am making a website that is styled using CSS, in two DIVs. One 'Header' DIV which is always the same, and a 'Content' DIV that changes.
In my CSS file, is it possible to write the HTML with all the links that stay in the header, so I just need to call (or similar) on every page, instead of having to write out my header content every time? Would also help in editing only one source, as I often leave out pages by mistake.
I don't want to use frames, so looking for an alternative.
Thanks,
Brett
Depending on the server and server side languages supported, this can be done.
Some servers will let you use Server Side Includes, for example. With others you could specify "block" of HTML for a header (for instance) that will be part of a site wide template.
What is not possible it to achieve this with purely CSS and HTML.
This is why you usually have some server side code running, which will insert the common header e.g. php include, SSI or other templating framework. If that's not an option, you could write JavaScript which writes out your header each time to a specific DIV. Although I don't think that's great from an SEO perspective.
The usual options for doing this client-side are an iframe, or some javascript that does DOM to add content (perhaps loaded from an external file). Or some javascript that creates an iframe. Or an iframe that creates some javascript. Some permutation of those odious techniques.
CSS does have the content property, but i think it's limited to plain text. I don't know if you can use it to pull in HTML, either using a string or URI.
As others have mentioned, the most common approach is to do it server-side. You can do this bottom-up with includes, or top-down with things like Tiles and SiteMesh.
CSS can't help you to do this.
You can make ajax loading of content. You can make one index.html and lot of 'content' files (about.html, contacts.html, etc). And in index.html you can load another .html in content-div (for example with jQuery method .load())
Another way - you can make little templating engine in php (or another server-side language)
It isn't possible to achieve that using CSS, because CSS can't handle any events, it's simply a "refrence" for the browser to know how to style your web-page, it's done, however, using AJAX.
I suggest you to take a look on jQuery lib, it'll speed up the process tremendously, however - the main disadvantage is that the search crawlers won't be able to index your page correctly, so it'll be bad by an SEO perspective.
It's possible, if you have the time, to make an index-able version and an AJAX one, that's what we did for a mobile project here.
jQuery AJAX API