Jump to content

need help in html


nidhi
 Share

Recommended Posts

i m writing a code to format a html page so that it fits a mobile screen size.all text or image or table, frames etc should be within that screen size.can u gv me an idea what logic should i use! if i use CSS thn what changes should be applied. i m writing a code in C,either i can use an external style sheet or by just reading the html code ad making some changes n then again writing the whole content into another file will do . plz suggest me any logic.thanx a lot,

Link to comment
Share on other sites

If you're trying to make one page that looks good on both 1280x1024 and 320x240, then you're going to have problems. You can always try to detect the user agent and send them a small-screen-formatted version of the same content.

Link to comment
Share on other sites

well, you could make a printer friendly version with just text, or you could use percentages.LG

thnx for ur reply.if i use only text then mozilla is supporting but IE is not working.i hvsend my code, plz go through it and tell me where i m wrongand hw to rectify it.can u suggest wat needs to b done for images?body { width: 176px ; /* nokia 176px screen */ border: thick solid red /* just to see the 'screen' limits */}*:not(#ImPoSsIbLeId):not(#ImPoSsIbLeId):not(#ImPoSsIbLeId):not(body):not(img) { /* the negated ID selectors above are here just to increase specificity */ width: auto ! important ;}*:not(#ImPoSsIbLeId):not(#ImPoSsIbLeId):not(#ImPoSsIbLeId) { /* the negated ID selectors above are here just to increase specificity */ position: static; float: none; text-align: left; padding: 0px; margin: 0px; top: auto; left: auto;}table,tbody,thead,tfoot,tr,td,th,col,colgroup { display: block;}iframe { display : none;}li { list-style-position: inside;}img[width=1] {display: none}var l = document.getElementsByTagName('img');for(var i = 0;i < l.length; i++) { if(l.width > 176) { l.height *= 176 /l.width; l.width = 176; } else if(l.naturalWidth > 176) { var e = 176 / l.naturalWidth; l.height = l.naturalHeight * e; l.width = 176; }}
Link to comment
Share on other sites

First you should validate all your pages to XHTML 1.0 Strict. All the relatively new cell phones should be able to parse correct xhtml. Then, you should use css to format the html. To get a different display on a cellphone than on a computer, you can import different css files depending on the detected media:http://www.w3schools.com/css/css_mediatypes.aspSo, "handheld" would be for example a cellphone, and you could have smaller values for that than "screen".

Link to comment
Share on other sites

First you should validate all your pages to XHTML 1.0 Strict. All the relatively new cell phones should be able to parse correct xhtml. Then, you should use css to format the html. To get a different display on a cellphone than on a computer, you can import different css files depending on the detected media:http://www.w3schools.com/css/css_mediatypes.aspSo, "handheld" would be for example a cellphone, and you could have smaller values for that than "screen".

i hv used a C code to read the input html code from a web page,then i hv linked an external style sheet at the head and stored the resultant code into another file.here is my code:
void main(){	char ch,tempch,tempch2,word[10],inbuf[24817],outbuf[24817];	int inccnt,outccnt,i,j,k;    FILE *fp, *fp2;	char tbstr[70]="<link rel=\"stylesheet\" type=\"text/css\" href=\"test2.css\" />";	    	int flag=0; //flag for <td>		fp= fopen("news.htm","rb");	if(fp == NULL)	{		printf("file1 not opened\n");		exit(1);	}	fp2 = fopen("out.htm","wb");	if(fp2 == NULL)	{		printf("file2 not opened\n");		exit(1);	}	fread(inbuf,24817,1,fp);	fclose(fp);	strlwr(inbuf);	i=0;	j=0;	while(j!= 24817)	{		ch = inbuf[j++];				if(ch=='<')		{			outbuf[i] = ch;			if(((ch=inbuf[j++]) =='h'))			{						k=0;						i++;						outbuf[i++] = ch;						for(;k<3;k++)						{							word[k]   = inbuf[j++];							outbuf[i++] = word[k];						}							word[k]   ='\0';						if((strcmp(word,"ead"))==0)						{							while((ch=inbuf[j++]) !='>')								outbuf[i++] = ch;							outbuf[i++]=ch;							outbuf[i]='\0';							strcat(outbuf,tbstr);							i=i+strlen(tbstr);						}			}			else			{				i++;				outbuf[i++] = ch;			}		}		else		{			outbuf[i++] = ch;		}	}	outbuf[i++] = '\0';		fwrite(outbuf,1,i,fp2);	fclose(fp2);}

Link to comment
Share on other sites

i m writing a code to format a html page so that it fits a mobile screen size.all text or image or table, frames etc should be within that screen size.can u gv me an idea what logic should i use! if i use CSS thn what changes should be applied. i m writing a code in C,either i can use an external style sheet or by just reading the html code ad making some changes n then again    writing the whole content into another file will do . plz suggest me any logic.thanx a lot,

Hi , I am Prashant, hv u ever use AJAX?If yes , may u help me how to integrate AJAX in .net?Awaiting..Prashant..
Link to comment
Share on other sites

Please don't hijack topics. Make your own thread for your questions. If you want help on AJAX, the JavaScript forum would be your best shot. Thank you.

Link to comment
Share on other sites

Actually, C doesn't have anything to do with either HTML or CSS. Are you confused about what you're doing? You attach a CSS sheet through a meta tag in the HTML page, neither of them have anything to do with the C programming language.

Link to comment
Share on other sites

You attach a CSS sheet through a meta tag in the HTML page, neither of them have anything to do with the C programming language.

actually what he means here (don't you? ) is you attach a CSS file through a LINK tag. just wanted to get that straight. :) LG
Link to comment
Share on other sites

Oh yeah, that's right.  Brainfart.

well, leave C coding...u r correct, i m attaching a CSS using link. if using external style sheet, thn we should link CSS like this:<link rel=\"stylesheet\" type=\"text/css\" href=\"handheld.css\" />we use @media=handheld when we have CSS in the same html na? in my CSS, wat should b done to make a web page compatible to a mobile screen.give me some guidelines...i m giving my code, plz hv a look over it. it works fine for simple pages, bt not for heavily decorated pages. i don't want to display flash objects, hw to da that?just tell me that writing in this way is OK? if i specify width in body, then will that b appicable throughout the page or i shall take some other approach?body { width: 176px ; /* nokia 176px screen */ border: thick solid red /* just to see the 'screen' limits */}*:not(#ImPoSsIbLeId):not(#ImPoSsIbLeId):not(#ImPoSsIbLeId):not(body):not(img) { /* the negated ID selectors above are here just to increase specificity */ width: auto ! important ;}*:not(#ImPoSsIbLeId):not(#ImPoSsIbLeId):not(#ImPoSsIbLeId) { /* the negated ID selectors above are here just to increase specificity */ position: static; float: none; text-align: left; padding: 0px; margin: 0px; top: auto; left: auto;}table,tbody,thead,tfoot,tr,td,th,col,colgroup { display: block;}iframe { display : none;}li { list-style-position: inside;}img[width=1] {display: none}var l = document.getElementsByTagName('img');for(var i = 0;i < l.length; i++) { if(l.width > 176) { l.height *= 176 /l.width; l.width = 176; } else if(l.naturalWidth > 176) { var e = 176 / l.naturalWidth; l.height = l.naturalHeight * e; l.width = 176; }}
Link to comment
Share on other sites

Well, here is the page about media types:http://www.w3schools.com/css/css_mediatypes.aspYou should probably either test the page on a handheld device, or use something like Opera, which will render the page as a handheld device if you press shift-F11. That way you can see what you are developing, and change things until you have it the way you want it. None of us knows what you want the page to look like, you know?

Link to comment
Share on other sites

Well, here is the page about media types:http://www.w3schools.com/css/css_mediatypes.aspYou should probably either test the page on a handheld device, or use something like Opera, which will render the page as a handheld device if you press shift-F11.  That way you can see what you are developing, and change things until you have it the way you want it.  None of us knows what you want the page to look like, you know?

i apologize if i m eating ur head. actually i only want that when i browse internet thru mobile, the web pages should appear same as they appear on desktop pc. and i want to write my own CSS for that.
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
 Share

×
×
  • Create New...