0
Under review

Linking HTML and CSS files

BWhell 11 years ago in iPad updated by Alexander Blach (Developer) 1 month ago 5

Hi,


I can't seem to get my HTML and CSS files to work together. They work fine in dreamweaver. I can't find much support on the subject. Please help.


<!DOCTYPE html>

<html>

<head>

<rel="stylesheet" type="text/css" link href="style.css">

​<meta charset="utf 8">

   <html lang="en">

​<title>Doctors Abroad SA</title>

</head>


.......


@charset "utf-8";

/* CSS Document */

 

/* Default Style */

 

header {

​height: 150px;

​background-color:#333;

​margin-bottom: none;

}


+1

Your link tag is wrong. 


Try to replace this line:


<rel="stylesheet" type="text/css" link href="style.css">


with this:


<link rel="stylesheet"  type="text/css" href="style.css">



Also try to run your HTML file through a HTML validator like this: http://validator.w3.org/#validate_by_input. There seem to be some other syntax issues with it.


For example, it should be:


<meta charset="utf-8">


Also, you have a second html tag inside the head section...

Thanks for the help. I made the changes but still can't see any changes applied through CSS.


<!DOCTYPE html>

<html>

<head>

<link rel="stylesheet" type="text/css" href="style.css">

​<meta charset="utf-8">

​<title>Doctors Abroad SA</title>

</head>

 

​<body>



........



@charset "utf-8";

/* CSS Document */

 

/* Default Style */

 

header {

​height: 150px;

​background-color:#333;

​margin-bottom: none;

}


I appreciate the help.


"header" in your CSS file is not a valid CSS selector since there is no "header" tag in HTML.

 

If "header" is used in a class attribute in your HTML file, you need to write ".header" instead of "header". If you instead have an HTML element with the id "header", you need to use "#header" as the CSS selector.


Try something like "body" to style the body tag.


It's hard to say what's correct in your case without seeing the rest of your html file.


This is really just basic HTML/CSS, so I'd recommend to have a look at some CSS and HTML tutorials on the web.

i have a similar problem, in my case… i don’t exactly know how to run html,css,and js together in Textastic.

Please teach me howwww🙇🏻‍♀️

i need it for my school assignment

Under review

Hello,

make sure to store your HTML, CSS and JS files somewhere in "Local Files", "iCloud" or in a folder added using "Add External Folder…". 

You can link to your CSS file using a "link" tag in the HTML file's head section like this:

<link rel="stylesheet" href="example.css">

Similarly, you can link an external JavaScript file like this:

<script src="myscript.js"></script>

If you then preview the HTML file using the "glasses" icon, the CSS and JavaScript file should be loaded.

Please have a look at these topics in the manual for details:

https://www.textasticapp.com/v10/manual/managing_files/local_files_icloud.html

https://www.textasticapp.com/v10/manual/viewing_editing_files/web_preview.html

https://www.textasticapp.com/v10/manual/integration_other_apps/external_files_folders.html#adding-external-folders

Note: The web preview cannot load the referenced files if you opened a single HTML file from the Files app using Textastic's "Open…" command since that only gives Textastic access to the single file you selected and not to its containing folder.