Jump to content

Link and Image Formatting


Kevin M

Recommended Posts

I'm making a web layout in XHTML Strict. According to W3C, the border and target attributes are not valid in Strict XHTML. So, in the CSS, how would I put it so that the images don't have a border, and the links all open in a new window?So I wouldn't have to do something like this:

<a href="http://site.com/index.php" target="_blank">Site.com</a>

and

<img src="http://site.com/image.jpg" border="0" alt="Alt Text" />

Which isn't valid XHTML.Thanks,Kevin

Link to comment
Share on other sites

And open in a new window, you need to do with JavaScript I think.Just wait and I'll update this post when I've found something (don't know if it works in XHTML strict)(Just copied this text from here)

window.open('url to open','window name','attribute1,attribute2') This is the function that allows you to open a new browser window for the viewer to use. Note that all the names and attributes are separated with a comma rather than spaces. Here is what all the stuff inside is: 'url to open'This is the web address of the page you wish to appear in the new window. 'window name'You can name your window whatever you like, in case you need to make a reference to the window later. 'attribute1,attribute2'As with alot of other things, you have a choice of attributes you can adjust. Window Attributes Below is a list of the attributes you can use: width=300Use this to define the width of the new window. height=200Use this to define the height of the new window. resizable=yes or noUse this to control whether or not you want the user to be able to resize the window. scrollbars=yes or noThis lets you decide whether or not to have scrollbars on the window. toolbar=yes or noWhether or not the new window should have the browser navigation bar at the top (The back, foward, stop buttons..etc.). location=yes or noWhether or not you wish to show the location box with the current url (The place to type http://address). directories=yes or noWhether or not the window should show the extra buttons. (what's cool, personal buttons, etc...). status=yes or noWhether or not to show the window status bar at the bottom of the window. menubar=yes or noWhether or not to show the menus at the top of the window (File, Edit, etc...). copyhistory=yes or noWhether or not to copy the old browser window's history list to the new window.<script type="text/javascript"> <!--hide function newwindow() { window.open('http://www.some-site.com','jav','width=300,height=200,resizable=yes');  // don't ask what jav is, because I have no idea} //--> </SCRIPT><a href="#" onclick="name_on_function()">hey!</a>

Link to comment
Share on other sites

Thanks for the help.I don't know if that JavaScript does this, but I want all links in a certain Div to open in a new window. Would that code only do it for a certain one? Or for every link in the div?Or is there some CSS code like:a {target: _blank;}That would work?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...